[PATCH] D25560: [ELF] Emit relocation for GOT entry even if it is an absolute symbol

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 07:32:54 PDT 2016


On 27 October 2016 at 04:42, Eugene Leviant <evgeny.leviant at gmail.com> wrote:
>> The entry in the got should always contain 42, not 42 + load address, no?
>
> Looks like it shouldn't. Just try running the same test case
> (abs-hidden.s) using ld.bfd and ld.gold.
> Interesting fact is that ld.bfd emits two relative relocs: one for
> .got and one for .text.

So, where are you seeing this being an issue? My argument is that it
looks like a bug in bfd/gold, no in lld.

Gold produces a relocation to set the got entry to 42 + load_address.
BFD does the same for the got, but also changes

.quad foo

to contain 42 + load_address at runtime. That really looks like a bug,
if in a single assembly file we have

        .quad foo
        foo=42

both gas and MC produce a file with no relocations and just the value
42. Why should splitting the asm file in two change it?

Cheers,
Rafael


More information about the llvm-commits mailing list