aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-05-06 14:57:58 +0000
committerIan Lance Taylor <ian@airs.com>2011-05-06 14:57:58 +0000
commit5b7b7d6e05dc23db02e401ec9fdf6d38cacafc41 (patch)
tree40d4d85b740d515ba7e3d7ac3ef23aa619a2dd7b
parentf3b574bf97c26bf49cad6a901c94cf831f3c362d (diff)
downloadgdb-5b7b7d6e05dc23db02e401ec9fdf6d38cacafc41.zip
gdb-5b7b7d6e05dc23db02e401ec9fdf6d38cacafc41.tar.gz
gdb-5b7b7d6e05dc23db02e401ec9fdf6d38cacafc41.tar.bz2
* layout.cc (Layout::layout): If the output section flags change,
update the ordering.
-rw-r--r--gold/ChangeLog5
-rw-r--r--gold/layout.cc13
2 files changed, 18 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 94c19bc..f198b80 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-06 Ian Lance Taylor <iant@google.com>
+
+ * layout.cc (Layout::layout): If the output section flags change,
+ update the ordering.
+
2011-04-25 Cary Coutant <ccoutant@google.com>
* incremental-dump.cc (dump_incremental_inputs): Print local
diff --git a/gold/layout.cc b/gold/layout.cc
index e397204..66d30d9 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -944,8 +944,21 @@ Layout::layout(Sized_relobj<size, big_endian>* object, unsigned int shndx,
// FIXME: Handle SHF_LINK_ORDER somewhere.
+ elfcpp::Elf_Xword orig_flags = os->flags();
+
*off = os->add_input_section(this, object, shndx, name, shdr, reloc_shndx,
this->script_options_->saw_sections_clause());
+
+ // If the flags changed, we may have to change the order.
+ if ((orig_flags & elfcpp::SHF_ALLOC) != 0)
+ {
+ orig_flags &= (elfcpp::SHF_WRITE | elfcpp::SHF_EXECINSTR);
+ elfcpp::Elf_Xword new_flags =
+ os->flags() & (elfcpp::SHF_WRITE | elfcpp::SHF_EXECINSTR);
+ if (orig_flags != new_flags)
+ os->set_order(this->default_section_order(os, false));
+ }
+
this->have_added_input_section_ = true;
return os;