diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2013-01-27 14:38:41 -0800 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2013-01-27 14:38:41 -0800 |
commit | dbb331ef919ae846a3983b7be1e5ffbb1ee1a839 (patch) | |
tree | bbda32952d67e2a1a9d8a12ab781bd93132cd88d /binutils-2.22/gold/layout.cc | |
parent | 43cc3f59831134ed0b2447bb21767371417ac54a (diff) | |
download | toolchain_binutils-dbb331ef919ae846a3983b7be1e5ffbb1ee1a839.tar.gz toolchain_binutils-dbb331ef919ae846a3983b7be1e5ffbb1ee1a839.tar.bz2 toolchain_binutils-dbb331ef919ae846a3983b7be1e5ffbb1ee1a839.zip |
[2.22.90] Backport of three patches to fix text section reordering
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.
2013-01-16 Sriraman Tallam <tmsriram@google.com>
* testsuite/plugin_final_layout.cc: Fix comment.
2013-01-16 Sriraman Tallam <tmsriram@google.com>
* layout.cc (Layout::layout): Do not do default sorting for
text sections when section ordering is specified.
(make_output_section): Ditto.
* testsuite/plugin_final_layout.cc: Name the function sections
to catch reordering issues.
Change-Id: I3413636486d578d3482f9a8ec1d93a0ec0a8f7d8
Diffstat (limited to 'binutils-2.22/gold/layout.cc')
-rw-r--r-- | binutils-2.22/gold/layout.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/binutils-2.22/gold/layout.cc b/binutils-2.22/gold/layout.cc index cc800cdb..994249b1 100644 --- a/binutils-2.22/gold/layout.cc +++ b/binutils-2.22/gold/layout.cc @@ -1081,7 +1081,9 @@ 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) os->set_must_sort_attached_input_sections(); @@ -1568,7 +1570,9 @@ 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) os->set_may_sort_attached_input_sections(); |