tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gcc-4.8 + ld issue for standalone programs



On Fri, Jan 03, 2014 at 10:01:42PM +0000, Christos Zoulas wrote:
> 
> the original xbn file looks like:
> 
>   .text           :
>   {
>     PROVIDE_HIDDEN (__eprol = .);
>     *(.text.unlikely .text.*_unlikely)
>     *(.text.exit .text.exit.*)
>     *(.text.startup .text.startup.*)
>     *(.text.hot .text.hot.*)
>     *(.text .stub .text.* .gnu.linkonce.t.*)
>     /* .gnu.warning sections are handled specially by elf32.em.  */
>     *(.gnu.warning)
>   }

I suspect the aim is to reduce the number of TLB entries by 'losing'
the code pages that aren't needed often.
It might be that the .rodata sections (usually linked next to the .text)
are in the opposite order.

> >Possible Solutions:
> >
> >1. Change the default xbn files to look like:
> >
> >  .text           :
> >  {
> >    PROVIDE_HIDDEN (__eprol = .);
> >    *(.text .stub .text.* .gnu.linkonce.t.*)
> >    *(.text.unlikely .text.*_unlikely)
> >    *(.text.exit .text.exit.*)
> >    *(.text.startup .text.startup.*)
> >    *(.text.hot .text.hot.*)
> >    /* .gnu.warning sections are handled specially by elf32.em.  */
> >    *(.gnu.warning)
> >  }

I think you should reverse the entire list.

However it might also be worth adding:
    *(.text.first)
or similar name (.text.entrypoint ?) line right at the top.

It isn't necessarily convenient, nor obvious to have the file
with the entrypoint first.
Also the file might have (say) a section that matches .stub and
the linker might decide to put that first anyway.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index