[PATCH] D30699: [ELF] - Stop producing broken output for R_386_GOT32X relocation.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 10:37:58 PDT 2017
ruiu added a comment.
I spent a few hours to understand the situation. Here are my conclusions:
1. The expression to compute R_386_GOT32 value in the i386 psABI draft version 1.1 doesn't indeed make sense. It says that you need to use G+A (as opposed to G+A-GOT) when the relocation is "[a]pplied on memory operand without base register when position-independent code is disabled". However, it is not doable because you are allowed to use R_386_GOT32 anywhere and we cannot make an assumption that an R_386_GOT32 follows some certain limited set of instructions. I think this is a bug in the draft spec.
2. That being said, I believe what we are doing now for R_386_GOT32X is correct, and this patch will break it. When you compute G+A instead of G+A-GOT for an R_386_GOT32X, you always need to rewrite instructions as well. If you don't rewrite instructions, you should always compute G+A-GOT (which is what we are currently doing.)
https://reviews.llvm.org/D30699
More information about the llvm-commits
mailing list