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

H.J. Lu via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 06:51:21 PDT 2016


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.

> 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?

-- 
H.J.


More information about the llvm-commits mailing list