RFC: Sort input section by list

Arjan van de Ven arjan@linux.intel.com
Tue Aug 26 14:47:00 GMT 2008


Nick Clifton wrote:
> Hi H.J.
> 
>> I got a request for a new linker feature to sort input sections by a
>> list provided at command line.
> 
> Is there a good reason for providing this list via a command line switch 
> as opposed to say using a suitably customised linker script ?  (Possibly 
> with an extended grammar for input section selection).

a customized linker script depends on which exact gcc is used.
it's also effectively impossible to use in an autoconf/automake/libtool world.

While just putting in a file with a list of names is a ton easier for the upstream or
package developer.... while just keeping all the rest of linker scripts and compiler interactions as is.

> 
>> 2. The linker script is similar to version script
>>
>> .text {
>>   extern "C++"
>>   {
>>     foo(int);
>>   };
>> };
>>
>> where .text will be the prefix of section name. It will match 
>> .text._Z3fooi.
> 
> What is the real purpose of this feature ?  Ie do you know why it has 
> been requested ?  The implication of the example you have given is that 
> the user wants to put certain name-mangled functions at the start of the 
> .text section, but why ?

because it allows the developer to put the commonly used functions at the start of the file,
improving density in the page cache for example, and generally improving startup time.
(less pagefaults and less TLB pressure)




More information about the Binutils mailing list