[RFH] How to teach ld to choose in an intelligent fashion which output sections to use for the ensemble of input sections.

Nick Clifton nickc@redhat.com
Wed Oct 19 16:35:00 GMT 2005


Hi Bjoern,

> What would be required for proper linking is that ld 1.)
> dynamically chooses the output section for the different input sections.
> I.e. all the ".text" input sections should end up in the output section
> (and corresponding region) ".text_low" until it is full. Then the
> remaining object files should be placed in the output section (region)
> ".text_high".

Although the linker could be taught to do this, it is hard to do so 
optimally.  Without profiling and control flow information the linker 
has to guess which output section would be the best for any particular 
input section.

> I considered to change the linker template scripts so that .text and
> .bankedtext end up to be "orphaned" sections so that the corresponding
> target hook could be used.? Is this the way to do it?

Actually this does sound like it ought to work.  I would suggest that 
you give it a try.

> Is there already a target that does something similar?

As far as I know, "no".  Normally in situations like this the problem is 
resolved by the application writer explicitly choosing the output 
sections for particular input sections, tweaking them as necessary in 
order to fill up the memory banks and get the best performance.

Cheers
   Nick




More information about the Binutils mailing list