This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Convert mov to lea for loading local function address
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Cc: Richard Henderson <rth at redhat dot com>
- Date: Fri, 31 Aug 2012 18:03:29 -0700
- Subject: Re: PATCH: Convert mov to lea for loading local function address
- References: <20120831042236.GA19539@intel.com> <CAMe9rOpeuHRDhVXURydFDk4nX1CmZDGSiVjiHERNjk9E0-ovWQ@mail.gmail.com>
On Fri, Aug 31, 2012 at 1:44 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Aug 30, 2012 at 9:22 PM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> Hi,
>>
>> I am checking in this patch to convert move mov to lea for loading local
>> function address.
>>
>> bfd/
>>
>> 2012-08-30 H.J. Lu <hongjiu.lu@intel.com>
>>
>> * elf32-i386.c (elf_i386_relocate_section): Convert
>> "mov foo@GOT(%reg), %reg" to "lea foo@GOTOFF(%reg), %reg"
>> for local symbols.
>>
>> * elf64-x86-64.c (elf_x86_64_relocate_section): Convert
>> "mov foo@GOTPCREL(%rip), %reg" to "lea foo@GOTOFF(%reg), %reg"
>> for local symbols.
>>
>
> Hi,
>
> I checked in this patch to move mov->lea conversion to
> size_dynamic_sections so that we can remove the unused
> GOT entries.
>
It turned out that overdid it for _DYNAMIC. Glibc ld.so has
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
first element of the GOT. This must be inlined in a function which
uses global data. */
static inline ElfW(Addr) __attribute__ ((unused))
elf_machine_dynamic (void)
We must avoid optimizing _DYNAMIC.
--
H.J.