* script-sections.cc
authorIan Lance Taylor <ian@airs.com>
Thu, 9 Jun 2011 19:25:02 +0000 (19:25 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 9 Jun 2011 19:25:02 +0000 (19:25 +0000)
(Orphan_output_section::set_section_addresses): For a relocatable
link set address to 0.

gold/ChangeLog
gold/script-sections.cc

index 5c705bf9b3efa0ded416a5f733e8b7dbe78a8a93..56e073f9a8705a882270d1cafdedeb046ae3f081 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-06-09  Cary Coutant  <ccoutant@google.com>
 
        PR gold/12804
index 10af8e11675c92a5a98d12a48970dd68ca0f965e..3bcc9e6adaa981821888f78aa16e8c64194fe1a7 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);
This page took 0.044326 seconds and 4 git commands to generate.