diff options
author | Cary Coutant <ccoutant@google.com> | 2013-05-30 23:01:11 +0000 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2013-05-30 23:01:11 +0000 |
commit | 6934001a98509d5f40ececbd9aa793b8969e27a3 (patch) | |
tree | e6b29c40e30acd5c3601df19a9fc5609fd618bd4 /gold/layout.cc | |
parent | 067ec077d717e716b0dba87b9ebfa25074cd5453 (diff) | |
download | gdb-6934001a98509d5f40ececbd9aa793b8969e27a3.zip gdb-6934001a98509d5f40ececbd9aa793b8969e27a3.tar.gz gdb-6934001a98509d5f40ececbd9aa793b8969e27a3.tar.bz2 |
2013-05-30 Alexander Ivchenko <alexander.ivchenko@intel.com>
Sriraman Tallam <tmsriram@google.com>
* options.h (sort_section): New option.
* output.h (Input_section_sort_section_prefix_special_ordering_compare):
Rename from Input_section_sort_section_name_special_ordering_compare.
(Input_section_sort_section_name_compare): New struct.
* output.cc (Output_section::Input_section_sort_section_name_compare::
operator()): New function.
(Output_section::sort_attached_input_sections): Use new sort function
for .text if --sort-section=name is specified.
* layout.cc (Layout::make_output_section):
Add sorting by name when --sort-section=name is specified.
* testsuite/Makefile.am (text_section_grouping): Test option
--sort-section=name.
* testsuite/Makefile.in: Regenerate.
* testsuite/section_sorting_name.cc: New file.
* testsuite/section_sorting_name.sh: New file.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r-- | gold/layout.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index 33fa473..65c3de6 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -1709,6 +1709,10 @@ Layout::make_output_section(const char* name, elfcpp::Elf_Word type, && strcmp(name, ".text") == 0) os->set_may_sort_attached_input_sections(); + // GNU linker sorts section by name with --sort-section=name. + if (strcmp(parameters->options().sort_section(), "name") == 0) + os->set_must_sort_attached_input_sections(); + // Check for .stab*str sections, as .stab* sections need to link to // them. if (type == elfcpp::SHT_STRTAB |