summaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2013-04-15 16:37:30 +0000
committerCary Coutant <ccoutant@google.com>2013-04-15 16:37:30 +0000
commitba4854cdde75a7aaeca25c858c2f2801a9ff5a8c (patch)
treeec0d54c73f293f557e4b7662ed2e5097400cd138 /gold
parent4dd4ce7fa6432bc9b99606f52e48c59a626e9dd4 (diff)
downloadbinutils-redhat-ba4854cdde75a7aaeca25c858c2f2801a9ff5a8c.tar.gz
gold/
* script-sections.cc (Orphan_output_section): Reset address to zero after each orphaned section for relocatable links.
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog5
-rw-r--r--gold/script-sections.cc14
2 files changed, 15 insertions, 4 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index a63521453b..595c017b60 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,10 @@
2013-04-15 Cary Coutant <ccoutant@google.com>
+ * script-sections.cc (Orphan_output_section): Reset address
+ to zero after each orphaned section for relocatable links.
+
+2013-04-15 Cary Coutant <ccoutant@google.com>
+
* symtab.cc (Symbol_table::sized_write_globals): Subtract
section starting address for relocatable link.
* testsuite/Makefile.am (script_test_11): New test.
diff --git a/gold/script-sections.cc b/gold/script-sections.cc
index 2fb8cbbcc9..a57e53ff2a 100644
--- a/gold/script-sections.cc
+++ b/gold/script-sections.cc
@@ -2918,11 +2918,17 @@ Orphan_output_section::set_section_addresses(Symbol_table*, Layout*,
address += size;
}
- // An SHF_TLS/SHT_NOBITS section does not take up any address space.
- if (this->os_ == NULL
- || (this->os_->flags() & elfcpp::SHF_TLS) == 0
- || this->os_->type() != elfcpp::SHT_NOBITS)
+ if (parameters->options().relocatable())
+ {
+ // For a relocatable link, reset DOT_VALUE to 0.
+ *dot_value = 0;
+ *load_address = 0;
+ }
+ else if (this->os_ == NULL
+ || (this->os_->flags() & elfcpp::SHF_TLS) == 0
+ || this->os_->type() != elfcpp::SHT_NOBITS)
{
+ // An SHF_TLS/SHT_NOBITS section does not take up any address space.
if (!have_load_address)
*load_address = address;
else