RFC: Sort input section by list
Christophe LYON
christophe.lyon@st.com
Tue Aug 26 16:41:00 GMT 2008
>> 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)
>
Why not have a tool dedicated to this kind of optimization?
For one of our targets, we have developed a post linker tool which
reorders functions based on call graph analysis.
The compiler driver asks the linker to keep all the relocations in the
generated executable, and then calls the optimizer, which parses the ELF
file and optionally a "layout file" to reorder code. By default it is
used to improve locality (we have a direct mapped cache) based on static
analysis, but can take advantage of profiling, or the user can even
force the function order.
If the purpose is really to reorder functions, why should the developer
need to deal with sections? (I mean, not all developers master the
concept of section, do they?)
Christophe.
More information about the Binutils
mailing list