Map "" and ".text.unlikely" input section prefixes to separate output sections.

Ian Lance Taylor
Fri Nov 16 16:40:00 GMT 2012

On Fri, Nov 16, 2012 at 8:16 AM,
<> wrote:
> Does the compiler generate, .text.unlikely, and .text.startup
> sections ? Or is this hand coded assembly ?

GCC generates them if you use the -freorder-functions option.

> Also why is gold mapping all .text.* sections to .text ? Doesnt it make
> sense to merge all of them to sections of their own and when segments are
> laid out, it can select how many of these sections are part of the segment.

gold is mostly trying to emulate the GNU linker here.  But it's not
crazy.  When using the GCC option -ffunction-sections you get a
different section for each function.  It doesn't really help anybody
to reflect all those sections in the output file.

> While I am at this, Is there an ordering restriction of how segments should
> appear in the output file ?
> By ordering of segments, I mean that
> segments with RX permissions appear before WX and so on, where does the code
> handle ordering of segments in the gold linker ?

The only ordering requirement is that PT_LOAD segments must appear in
load-address order, and the PT_PHDR and PT_INTERP segments must come
before any PT_LOAD segments.

In gold segment ordering is handled by Layout::segment_precedes.


More information about the Binutils mailing list