how to link a section in specific .o inside .a via linker script?

Mat Hostetter mat@lcs.mit.edu
Fri Feb 2 22:10:00 GMT 2007


>> P.S. I also needed to change the link map generator to write out the required
>>      alignment of each section alongside its address and size information.
>>      I wrote it out as a comment to try to be compatible with any tools
>>      parsing linker maps, but that's kinda gross. I wonder if anyone
>>      else wants the alignment information in a convenient way.

>I think that this would be a useful addition to the -Map output.  (It
>might also help spot cases where section alignment is not being
>handled correctly).  For compatibility sakes though, maybe a variant
>of the -Map switch should be used instead.  eg:
>
>   -Map-with-alignments <FILE>

Arguably the right way to do this is to go a farther and add a
-Map-xml <FILE> flag that writes out all of the linker map information
in some well-defined XML format.  Tools that processed the XML would
be likely to be much more resilient to future extensions.

Linker tools would also be easier to write given an XML format, as the
current format has some oddities (e.g. input sections with long names
appear with a newline between the section's name and its address, but
sections with short names do not).

-Mat



More information about the Binutils mailing list