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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 13:49:17 PDT 2017


> "name at GOT" is a memory operand.  It is usually computed as "G + A" to
> get the GOT address.   If it is computed as G + A - GOT,
>
> op name at GOT, %reg
>
> will lead to random result since G + A - GOT is the GOT index, not address.
> LEA is an exception, relocation in

I can't reproduce this behavior with gnu tools.

Given non-pic.s with just

mov _start at GOT, %eax

gas will produce a R_386_GOT32X even with --mrelax-relocations=no, so
I used llvm-mc instead to get a R_386_GOT32.

Then linking as

ld.bfd -m elf_i386 start.o non-pic.o -o non-pic

will produce

08048094 <_start>:
 8048094:       a1 fc ff ff ff          mov    0xfffffffc,%eax

So looks like it is computing G + A - GOT.

Cheers,
Rafael


More information about the llvm-commits mailing list