summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2013-01-16 22:47:14 +0000
committerSriraman Tallam <tmsriram@google.com>2013-01-16 22:47:14 +0000
commit7b4e4a6acc06563bdb91ef46a5eb3070c0f279e9 (patch)
tree2001b230c4b09c9e249c0e59cd6b1ec226263a48 /gold
parentf89b024fd0285654ee2e48c52e86b9aafc886710 (diff)
downloadbinutils-redhat-7b4e4a6acc06563bdb91ef46a5eb3070c0f279e9.tar.gz
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.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog8
-rw-r--r--gold/layout.cc2
-rw-r--r--gold/testsuite/plugin_final_layout.cc8
3 files changed, 17 insertions, 1 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index f5969f0371..9e998a8d63 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,11 @@
+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.
+
2013-01-15 Alan Modra <amodra@gmail.com>
* powerpc.cc (Target_powerpc::do_relax): Default shared libs to
diff --git a/gold/layout.cc b/gold/layout.cc
index f7f0e7e33a..576d44bee2 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -1150,6 +1150,7 @@ 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()
+ && !this->is_section_ordering_specified()
&& !parameters->options().relocatable()
&& Layout::special_ordering_of_input_section(name) >= 0)
os->set_must_sort_attached_input_sections();
@@ -1646,6 +1647,7 @@ Layout::make_output_section(const char* name, elfcpp::Elf_Word type,
// need to know that this might happen before we attach any input
// sections.
if (!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();
diff --git a/gold/testsuite/plugin_final_layout.cc b/gold/testsuite/plugin_final_layout.cc
index 3e264f623a..88dea30d4b 100644
--- a/gold/testsuite/plugin_final_layout.cc
+++ b/gold/testsuite/plugin_final_layout.cc
@@ -21,16 +21,22 @@
// MA 02110-1301, USA.
// The goal of this program is to verify if section ordering
-// via plugins happens correctly.
+// via plugins happens correctly. Also, test is plugin based ordering
+// overrides default text section ordering where ".text.hot" sections
+// are grouped. The plugin does not want foo and baz next to each other.
+// Plugin section order is foo() followed by bar() and then baz().
+__attribute__ ((section(".text._Z3barv")))
void bar ()
{
}
+__attribute__ ((section(".text.hot._Z3bazv")))
void baz ()
{
}
+__attribute__ ((section(".text.hot._Z3foov")))
void foo ()
{
}