From: Cary Coutant Date: Mon, 15 Apr 2013 16:37:30 +0000 (+0000) Subject: gold/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2199fbe773f0795a92afb9a2383b463ccd936008;p=binutils-gdb.git gold/ * script-sections.cc (Orphan_output_section): Reset address to zero after each orphaned section for relocatable links. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index a63521453b6..595c017b607 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2013-04-15 Cary Coutant + + * script-sections.cc (Orphan_output_section): Reset address + to zero after each orphaned section for relocatable links. + 2013-04-15 Cary Coutant * symtab.cc (Symbol_table::sized_write_globals): Subtract diff --git a/gold/script-sections.cc b/gold/script-sections.cc index 2fb8cbbcc9b..a57e53ff2a6 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