summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2011-06-09 19:27:35 +0000
committerIan Lance Taylor <ian@airs.com>2011-06-09 19:27:35 +0000
commit61d6404afb4d88eec7f63662932171ef8160577e (patch)
tree8b955ea293f830ae81d5b80560af8dd3c2f22d20
parent100d716db27575a22a19dc9545ed3fcf3ca6e498 (diff)
downloadbinutils-redhat-61d6404afb4d88eec7f63662932171ef8160577e.tar.gz
* script-sections.cc
(Orphan_output_section::set_section_addresses): For a relocatable link set address to 0.
-rw-r--r--gold/ChangeLog6
-rw-r--r--gold/script-sections.cc11
2 files changed, 17 insertions, 0 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 96f0949fcf..347d7f4145 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -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
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index 697c46a304..b60d024a62 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -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);