This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[GOLD] Fix PR14566
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 10 Sep 2012 15:34:09 +0930
- Subject: [GOLD] Fix PR14566
This layout.cc change fixes PR14566, and 29 testsuite failures. The
output.cc changes cure 4 further relro testsuite failures on powerpc.
OK?
PR gold/14566
* layout.cc (Layout::set_segment_offsets): When using
common-page-size alignment, ensure we are on a new max-page-size
page.
* output.cc (Output_segment::set_section_addresses): Use
abi_pagesize, not common_pagesize for relro boundary.
(Output_segment::set_offset): Likewise.
Index: gold/layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.237
diff -u -p -r1.237 layout.cc
--- gold/layout.cc 30 Aug 2012 05:57:05 -0000 1.237
+++ gold/layout.cc 10 Sep 2012 05:48:47 -0000
@@ -3420,6 +3420,8 @@ Layout::set_segment_offsets(const Target
*pshndx = shndx_hold;
addr = align_address(aligned_addr, common_pagesize);
addr = align_address(addr, (*p)->maximum_alignment());
+ if ((addr & (abi_pagesize - 1)) != 0)
+ addr = addr + abi_pagesize;
off = orig_off + ((addr - orig_addr) & (abi_pagesize - 1));
off = align_file_offset(off, addr, abi_pagesize);
Index: gold/output.cc
===================================================================
RCS file: /cvs/src/src/gold/output.cc,v
retrieving revision 1.171
diff -u -p -r1.171 output.cc
--- gold/output.cc 5 Sep 2012 00:34:20 -0000 1.171
+++ gold/output.cc 10 Sep 2012 05:48:47 -0000
@@ -4211,7 +4239,7 @@ Output_segment::set_section_addresses(La
bool in_tls = false;
// If we have relro sections, we need to pad forward now so that the
- // relro sections plus INCREASE_RELRO end on a common page boundary.
+ // relro sections plus INCREASE_RELRO end on an abi page boundary.
if (parameters->options().relro()
&& this->is_first_section_relro()
&& (!this->are_addresses_set_ || reset))
@@ -4266,7 +4294,7 @@ Output_segment::set_section_addresses(La
last_relro_pad = aligned_size - relro_size;
*has_relro = true;
- uint64_t page_align = parameters->target().common_pagesize();
+ uint64_t page_align = parameters->target().abi_pagesize();
// Align to offset N such that (N + RELRO_SIZE) % PAGE_ALIGN == 0.
uint64_t desired_align = page_align - (aligned_size % page_align);
@@ -4576,7 +4604,7 @@ Output_segment::set_offset(unsigned int
// page boundary.
if (this->type_ == elfcpp::PT_GNU_RELRO)
{
- uint64_t page_align = parameters->target().common_pagesize();
+ uint64_t page_align = parameters->target().abi_pagesize();
uint64_t segment_end = this->vaddr_ + this->memsz_;
if (parameters->incremental_update())
{
--
Alan Modra
Australia Development Lab, IBM