[PATCH] D26133: [ELF] Allow relative relocations to absolute symbols in PIC

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 17 06:33:12 PDT 2017


Petr Hosek <phosek at google.com> writes:

> On Wed, Mar 8, 2017 at 10:52 AM Cary Coutant <ccoutant at gmail.com> wrote:
>
>> No, symbols in an ET_EXEC or ET_DYN object always have
>> already-relocated values. The section index is irrelevant other than
>> to indicate that the symbol is not absolute or undefined. That's the
>> point of the paragraph I quoted from the end of the symbol table
>> chapter from the ELF spec. In gold, I try to find a section that
>> belongs to the segment that the symbol is associated with, but setting
>> st_shndx to 1 would be just as effective.
>>
>
> I think this is an issue in LLD. I started experimenting with the solution
> proposed by Peter which is to replace that linker script with:
>
> PROVIDE_HIDDEN(_base = ADDR(.text) - ABSOLUTE(ADDR(.text)));

I think this is fixed as of r298082. I added a testcase in r298083. Let
me know if I missed something.

Cheers,
Rafael


More information about the llvm-commits mailing list