[PATCH] PR gold/17640
H.J. Lu
hjl.tools@gmail.com
Fri Mar 13 18:55:00 GMT 2015
On Fri, Mar 13, 2015 at 11:37 AM, Cary Coutant <ccoutant@google.com> wrote:
>>> You still haven't explained why we need to look for the symbol
>>> "_DYNAMIC" and treat it as a special case.
>>
>> This isn't the optimal code. Compiler may generate
>>
>> movl %eax, %edx
>> movl _DYNAMIC@GOT(%ecx), %eax
>> addl %edx, %eax
>>
>> instead of
>>
>> addl _DYNAMIC@GOT(%ecx), %eax
>>
>> I just want to be on the safe side.
>
> You're still not explaining. If the compiler generates that sequence,
> and we convert the mov to lea, why do we need the GOT entry?
>
LEA gives you the value after the program has bee loaded
to memory at run-time. But in ld.so before it has bootstrapped itself
movl _DYNAMIC@GOT(%ecx), %eax
gives you the link-time address, which what ld.so wants to bootstrap
itself.
--
H.J.
More information about the Binutils
mailing list