* layout.cc (Layout::layout): If the output section flags change,
authorIan Lance Taylor <ian@airs.com>
Fri, 6 May 2011 14:57:58 +0000 (14:57 +0000)
committerIan Lance Taylor <ian@airs.com>
Fri, 6 May 2011 14:57:58 +0000 (14:57 +0000)
update the ordering.

gold/ChangeLog
gold/layout.cc

index 94c19bc582fa80d7b097770f05eef540a3701fe4..f198b806cd9406f0807230529f86ab585ba8898b 100644 (file)
@@ -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
index e3972040b6c413ae4af6016a2f4deeca1edd70c6..66d30d9ee800d3915abd0640819eab9387a4a591 100644 (file)
@@ -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;
This page took 0.032357 seconds and 4 git commands to generate.