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

Haase Bjoern (PT-BEU/EMT) * Bjoern.Haase@de.bosch.com
Tue Oct 18 14:39:00 GMT 2005


Hi,

When working with banked memory on a HC12 device I am facing the
difficulty, that the ld presently is not able to distribute the contents
of the object files over different pages.

I.e. the challange is:

Text output of gcc for the different elf object files (only relevant bfd
format for hc12) is located in two different sections named ".text" and
".bankedtext". 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". Correspondingly the different input sections ".bankedtext"
should end up in the output sections ".bankedtext_01" up to
".bankedtext_1F". Assigning the different bfds to the different output
sections on a per-file basis in a memory.x file is extremely cumbersome
and error prone. Especially for the 32 banked-memory output sections.

Question:

Where is the appropriate place to teach ld to choose the right output
section for the different input sections?

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?

Is there already a target that does something similar?

Yours,

Bjoern.






More information about the Binutils mailing list