diff options
author | Ian Lance Taylor <ian@airs.com> | 2011-05-06 14:58:17 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2011-05-06 14:58:17 +0000 |
commit | 41619a7a749f1efc99b223d964c3e5a139a6934b (patch) | |
tree | 71f3dac962b20b352ec5538d4ad8e5d70cbe8061 | |
parent | cf28e023833f158021179f8c6acf2f0bfb3daa7f (diff) | |
download | binutils-redhat-41619a7a749f1efc99b223d964c3e5a139a6934b.tar.gz |
* layout.cc (Layout::layout): If the output section flags change,
update the ordering.
-rw-r--r-- | gold/ChangeLog | 5 | ||||
-rw-r--r-- | gold/layout.cc | 13 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index cf93c509c7..081f900c05 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-03-14 Ian Lance Taylor <iant@google.com> * script-sections.cc (Sort_output_sections::script_compare): diff --git a/gold/layout.cc b/gold/layout.cc index 70efef9743..b7c4fa5944 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -674,8 +674,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; |