]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* script-sections.cc
authorIan Lance Taylor <ian@airs.com>
Thu, 9 Jun 2011 19:27:56 +0000 (19:27 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 9 Jun 2011 19:27:56 +0000 (19:27 +0000)
(Orphan_output_section::set_section_addresses): For a relocatable
link set address to 0.

gold/ChangeLog
gold/script-sections.cc

index 96f0949fcf73aa48166cb40defbc41bf1d1d2636..347d7f4145418c8adbf6255f08361d5e41843cbf 100644 (file)
@@ -1,3 +1,9 @@
+2011-06-09  Ian Lance Taylor  <iant@google.com>
+
+       * script-sections.cc
+       (Orphan_output_section::set_section_addresses): For a relocatable
+       link set address to 0.
+
 2011-05-29  Ian Lance Taylor  <iant@google.com>
 
        * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
index 697c46a304555660d81a9fd302d8a92f4b516591..b60d024a62f7bc1a34b9d119577b86a6cdd9425d 100644 (file)
@@ -2846,6 +2846,17 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*,
   uint64_t address = *dot_value;
   address = align_address(address, this->os_->addralign());
 
+  // For a relocatable link, all orphan sections are put at
+  // address 0.  In general we expect all sections to be at
+  // address 0 for a relocatable link, but we permit the linker
+  // script to override that for specific output sections.
+  if (parameters->options().relocatable())
+    {
+      address = 0;
+      *load_address = 0;
+      have_load_address = false;
+    }
+
   if ((this->os_->flags() & elfcpp::SHF_ALLOC) != 0)
     {
       this->os_->set_address(address);