[PATCH] D30699: [ELF] - Stop producing broken output for R_386_GOT32X relocation.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 14 01:37:33 PDT 2017


grimar added a comment.

In https://reviews.llvm.org/D30699#699688, @ruiu wrote:

> I think that if we are doing something wrong for the R_386_GOT32 relocation, you want to fix that first, as that is not (directly) related to the GOT32X relocation.


I disagree. We probably do not want to do something with R_386_GOT32 at all. For R_386_GOT32**X** ABI explicitly says that: "The R_386_GOT32**X** relocation can be used to compute the address of the
symbol’s global offset table entry without base register when position-independent code is disabled. ".
ABI says nothing like this about R_386_GOT32. I assume that gold/bfd implemented them in the same way to support outdated producers.

It is like they optimize R_X86_64_GOTPCREL, R_X86_64_GOTPCRELX, R_X86_64_REX_GOTPCRELX, in the same way, but we do that only for latter 2. We are always trying to follow what ABI says explicitly, them are not.

My patch is about R_386_GOT32**X** for baseless instruction case, I know a producer of this relocation - it is "GNU as v.2.27" as mentioned in testcase. I do not know modern producer which
will emit R_386_GOT32 for the same place. So my patch is 100% consistent with current ABI and I do not think we should do something different from what ABI says explicitly until there is a solid reason.
For now there is **no** such reason for R_386_GOT32, but there **is** for R_386_GOT32**X** (broken output using GAS 2.27).


https://reviews.llvm.org/D30699





More information about the llvm-commits mailing list