This is the mail archive of the
mailing list for the binutils project.
Re: Map ".text.hot" and ".text.unlikely" input section prefixes to separate output sections.
- From: Ian Lance Taylor <iant at google dot com>
- To: "shankarke at gmail dot com" <shankarke at gmail dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 16 Nov 2012 08:40:08 -0800
- Subject: Re: Map ".text.hot" and ".text.unlikely" input section prefixes to separate output sections.
- References: <CAAs8HmygtSkVh3v4dz2hBTzS1AH-rLbBkTDJ-hVkzENC2sqQZg@mail.gmail.com> <email@example.com>
On Fri, Nov 16, 2012 at 8:16 AM, firstname.lastname@example.org
> Does the compiler generate .text.hot, .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.