aboutsummaryrefslogtreecommitdiff
path: root/gold/layout.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-10-16 05:00:29 +0000
committerIan Lance Taylor <ian@airs.com>2009-10-16 05:00:29 +0000
commit661be1e21e12f87f58c14d0ef8caaee770857297 (patch)
treeb75b937378c483fd6ade5c1b1ff132e1625c28e3 /gold/layout.cc
parent6b3159bb460f231beae8b0179fecbc74e31d9d17 (diff)
downloadbinutils-661be1e21e12f87f58c14d0ef8caaee770857297.zip
binutils-661be1e21e12f87f58c14d0ef8caaee770857297.tar.gz
binutils-661be1e21e12f87f58c14d0ef8caaee770857297.tar.bz2
* layout.cc (Layout::set_segment_offsets): Align the file offset
to the segment aligment for -N or -n with no load segment. * output.cc (Output_segment::add_output_section): Don't crash if the first section is a TLS section. (Output_segment::set_section_list_addresses): Print an error message if the address moves backward in a linker script. * script-sections.cc (Output_section_element_input::set_section_addresses): Don't increase *dot_value for a SHF_TLS/SHT_NOBITS section. (Orphan_output_section::set_section_addresses): Likewise.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r--gold/layout.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gold/layout.cc b/gold/layout.cc
index ad3ee1b..0b62c18 100644
--- a/gold/layout.cc
+++ b/gold/layout.cc
@@ -2237,6 +2237,19 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg,
if (!parameters->options().nmagic()
&& !parameters->options().omagic())
off = align_file_offset(off, addr, abi_pagesize);
+ else if (load_seg == NULL)
+ {
+ // This is -N or -n with a section script which prevents
+ // us from using a load segment. We need to ensure that
+ // the file offset is aligned to the alignment of the
+ // segment. This is because the linker script
+ // implicitly assumed a zero offset. If we don't align
+ // here, then the alignment of the sections in the
+ // linker script may not match the alignment of the
+ // sections in the set_section_addresses call below,
+ // causing an error about dot moving backward.
+ off = align_address(off, (*p)->maximum_alignment());
+ }
unsigned int shndx_hold = *pshndx;
uint64_t new_addr = (*p)->set_section_addresses(this, false, addr,