summaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2013-01-24 18:49:55 +0000
committerSriraman Tallam <tmsriram@google.com>2013-01-24 18:49:55 +0000
commitc6ac678db54ed727cb673a87beeb7a41bdf13182 (patch)
treeb2a220a0034d74e463386bb5efa8e1ac0a2fd697 /gold/layout.cc
parent45e6c716a91b609472e7b807347f9ed3a86c8113 (diff)
downloadbinutils-gdb-c6ac678db54ed727cb673a87beeb7a41bdf13182.tar.gz
Default text reordering fix with a flag to turn it off.
2013-01-24 Sriraman Tallam <tmsriram@google.com> * layout.cc (Layout::layout): Check for option text_reorder. (Layout::make_output_section): Ditto. * options.h (text_reorder): New option. * output.cc (Input_section_sort_compare): Remove special ordering of section names. (Output_section:: Input_section_sort_section_name_special_ordering_compare:: operator()): New function. (Output_section::sort_attached_input_sections): Use new sort function for .text. * output.h (Input_section_sort_section_name_special_ordering_compare): New struct. * testsuite/Makefile.am (text_section_grouping): Test option --no-text-reorder * testsuite/Makefile.in: Regenerate. * testsuite/text_section_grouping.sh: Check order of functions without default text reordering.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index 250782a92be..1eb2cc018d3 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1149,7 +1149,8 @@ Layout::layout(Sized_relobj_file<size, big_endian>* object, unsigned int shndx,
// By default the GNU linker sorts some special text sections ahead
// of others. We are compatible.
- if (!this->script_options_->saw_sections_clause()
+ if (parameters->options().text_reorder()
+ && !this->script_options_->saw_sections_clause()
&& !this->is_section_ordering_specified()
&& !parameters->options().relocatable()
&& Layout::special_ordering_of_input_section(name) >= 0)
@@ -1646,7 +1647,8 @@ Layout::make_output_section(const char* name, elfcpp::Elf_Word type,
// sections before other .text sections. We are compatible. We
// need to know that this might happen before we attach any input
// sections.
- if (!this->script_options_->saw_sections_clause()
+ if (parameters->options().text_reorder()
+ && !this->script_options_->saw_sections_clause()
&& !this->is_section_ordering_specified()
&& !parameters->options().relocatable()
&& strcmp(name, ".text") == 0)