This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Fri, Nov 16, 2012 at 8:16 AM, shankarke@gmail.com
<shankarke@gmail.com> wrote:
>
> 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.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]