This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: x86 - linker optimization of "call *constant_variable" -feasible?


Alan Modra <amodra@bigpond.net.au> writes:

> On Tue, Aug 12, 2003 at 09:26:11PM -0700, Zack Weinberg wrote:
>>    0:   e8 fc ff ff ff          call   1 <foo+0x1>
>>                         1: R_386_PC32   B
>>    5:   ff 15 00 00 00 00       call   *0x0
>>                         7: R_386_32     A
>> 
>> The second call is significantly slower than the first, because of the
>> extra memory fetch.  I'm wondering whether it is feasible for the
>> linker to optimize the second call into the first.
>
> Yes, but you'd need to mark the call somehow (eg. with a new reloc type)
> to indicate the call should be optimized.  The reason being that
> R_386_32 is used in other situations, and it's not safe for the linker
> to read code bytes to determine whether R_386_32 applies to a call.

Ok, so, I'm not necessarily volunteering to implement this, but could
you give me a rundown on how one adds a new reloc type, and what
pitfalls one might encounter?  Are there backward compatibility
concerns?

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]