diff options
author | Sriraman Tallam <tmsriram@google.com> | 2012-12-19 02:55:15 +0000 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2012-12-19 02:55:15 +0000 |
commit | 28f2a4ac6f40b5bf1fccc1fa320b41f82f3c5cc9 (patch) | |
tree | 07a61340c8370a3db3f6fdafa7c020d26eaaf70e /gold/layout.cc | |
parent | *** empty log message *** (diff) | |
download | binutils-gdb-28f2a4ac6f40b5bf1fccc1fa320b41f82f3c5cc9.tar.gz binutils-gdb-28f2a4ac6f40b5bf1fccc1fa320b41f82f3c5cc9.tar.bz2 binutils-gdb-28f2a4ac6f40b5bf1fccc1fa320b41f82f3c5cc9.zip |
Group text sections with prefixes .text.unlikely,.text.hot and .text.startup
by default.
2012-12-18 Sriraman Tallam <tmsriram@google.com>
* layout.cc (Layout::is_section_name_prefix_grouped): New function.
* layout.h (Layout::is_section_name_prefix_grouped): New function.
* output.cc (Output_section::add_input_section): Check if section
name contains special prefix. Keep input sections to sort such
sections.
(Output_section::Input_section_sort_section_order_index_compare
::operator()): Group sections according to prefixes.
* (Output_section::sort_attached_input_sections): Add condition
to Input_section_entry constructor call.
* testsuite/Makefile.am (text_section_grouping): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/text_section_grouping.cc: New file.
* testsuite/text_section_grouping.sh: New file.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r-- | gold/layout.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index 60fabb8b819..62b4cadf9d3 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -2409,6 +2409,20 @@ Layout::relaxation_loop_body( return off; } +// By default, gold groups input sections with certain prefixes. This +// function returns true if this section name NAME contains such a prefix. + +bool +Layout::is_section_name_prefix_grouped(const char *name) +{ + if (is_prefix_of(".text.unlikely", name) + || is_prefix_of(".text.startup", name) + || is_prefix_of(".text.hot", name)) + return true; + + return false; +} + // Search the list of patterns and find the postion of the given section // name in the output section. If the section name matches a glob // pattern and a non-glob name, then the non-glob position takes |