* script-sections.cc

(Orphan_output_section::set_section_addresses): For a relocatable
	link set address to 0.
This commit is contained in:
Ian Lance Taylor 2011-06-09 19:25:02 +00:00
parent 4fb3a1c35a
commit a94907d981
2 changed files with 17 additions and 0 deletions

View 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

View 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);