aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-03-01 21:50:06 +0000
committerIan Lance Taylor <ian@airs.com>2011-03-01 21:50:06 +0000
commit46d165019533a1f989f0047178ff14a1496d2cc6 (patch)
treebd712d62a68873d1ed2536b04ce493869bbef817 /gold
parentf3f19f66f87ce9eb9469b6e7c2cc616e597c69b7 (diff)
downloadfsf-binutils-gdb-46d165019533a1f989f0047178ff14a1496d2cc6.zip
fsf-binutils-gdb-46d165019533a1f989f0047178ff14a1496d2cc6.tar.gz
fsf-binutils-gdb-46d165019533a1f989f0047178ff14a1496d2cc6.tar.bz2
Backport from mainline:
2011-01-04 Cary Coutant <ccoutant@google.com> * script-sections.cc (Sort_output_sections::operator()): Sort TLS sections before NOBITS sections.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog7
-rw-r--r--gold/script-sections.cc19
2 files changed, 17 insertions, 9 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 4a70cba..30943c8f 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,10 @@
+2011-03-01 Ian Lance Taylor <iant@google.com>
+
+ Backport from mainline:
+ 2011-01-04 Cary Coutant <ccoutant@google.com>
+ * script-sections.cc (Sort_output_sections::operator()): Sort TLS
+ sections before NOBITS sections.
+
2011-02-27 Ian Lance Taylor <iant@google.com>
Backport from mainline:
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index 487cc24..38831b4 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -1,6 +1,6 @@
// script-sections.cc -- linker script SECTIONS for gold
-// Copyright 2008, 2009 Free Software Foundation, Inc.
+// Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
@@ -3586,17 +3586,18 @@ Sort_output_sections::operator()(const Output_section* os1,
if (os1->address() != os2->address())
return os1->address() < os2->address();
- // Sort TLS sections to the end.
+ // Sort PROGBITS before NOBITS.
+ bool nobits1 = os1->type() == elfcpp::SHT_NOBITS;
+ bool nobits2 = os2->type() == elfcpp::SHT_NOBITS;
+ if (nobits1 != nobits2)
+ return nobits2;
+
+ // Sort PROGBITS TLS sections to the end, NOBITS TLS sections to the
+ // beginning.
bool tls1 = (os1->flags() & elfcpp::SHF_TLS) != 0;
bool tls2 = (os2->flags() & elfcpp::SHF_TLS) != 0;
if (tls1 != tls2)
- return tls2;
-
- // Sort PROGBITS before NOBITS.
- if (os1->type() == elfcpp::SHT_PROGBITS && os2->type() == elfcpp::SHT_NOBITS)
- return true;
- if (os1->type() == elfcpp::SHT_NOBITS && os2->type() == elfcpp::SHT_PROGBITS)
- return false;
+ return nobits1 ? tls1 : tls2;
// Sort non-NOLOAD before NOLOAD.
if (os1->is_noload() && !os2->is_noload())