Group static constructors and destructors in specific subsections

Cary Coutant ccoutant@google.com
Thu Oct 21 18:02:00 GMT 2010


> I am not sure how to update gold - I basically copied existing code in binutils
> for .text.unlikely group in GNU LD linker script, but I think gold is doing
> independent decisions somewhere.

Gold doesn't have a default linker script. The code that handles the
default section name mappings is Layout::output_section_name() in
gold/layout.cc. If you add a couple of entries to the mapping array
Layout::section_name_mapping[], you can easily change gold to group
.text.startup and .text.exit sections together without mapping them
all into .text. You can tweak the ordering of the output sections, if
you want to, in Layout::default_section_order().

-cary



More information about the Gcc-patches mailing list