RFC: Sort input section by list

H.J. Lu hjl.tools@gmail.com
Mon Aug 25 23:52:00 GMT 2008


Hi,

I got a request for a new linker feature to sort input sections by a
list provided
at command line. I am investigating the following approach:

1. Change --sort-section to accept a linker script with a list of sections.
2. The linker script is similar to version script

.text {
  extern "C++"
  {
    foo(int);
  };
};

where .text will be the prefix of section name. It will match .text._Z3fooi.
3. Linker will insert .text._Z3fooi before ".text.*" in linker script, to turn

.text           :
{
    *(.text .stub .text.* .gnu.linkonce.t.*)
}

into

.text           :
{
    *(.text .stub .text._Z3fooi. .text.* .gnu.linkonce.t.*)
}
4. Multiple  --sort-section will be supported.

Any comments?

Thanks.


-- 
H.J.



More information about the Binutils mailing list