[PATCH] D20024: [ELF] - Protect first entries of got.plt with RelRo.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 07:18:03 PDT 2016


On 9 May 2016 at 09:51, H.J. Lu <hjl.tools at gmail.com> wrote:
> On Mon, May 9, 2016 at 6:47 AM, Rafael EspĂ­ndola
> <rafael.espindola at gmail.com> wrote:
>>> Since the the link-time address of _DYNAMIC is stored in the first element
>>> of the GOT as specified by the x86-64 psABI, one can use
>>>
>>> movq _GLOBAL_OFFSET_TABLE_(%rip), %rax
>>>
>>> to get the link-time address of _DYNAMIC.
>>
>> Given that this is being done before relocations, what is the
>> difference from just using _DYNAMIC?
>
> It is the link-time address of _DYNAMIC vs the run-time address of
>  _DYNAMIC.


Do you know how it is used?


>> I couldn't find the code in the glibc dynamic linker, but I noticed
>> musl uses _DYNAMIC and I was able to bootstrap without setting got[0]
>> with glibc.
>
> Did you build ld.so in glibc with it?

No. I would be surprised if we are already able to link it. Can we?

Cheers,
Rafael


More information about the llvm-commits mailing list