PR gold/14566
authorAlan Modra <amodra@gmail.com>
Mon, 10 Sep 2012 23:10:41 +0000 (23:10 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 10 Sep 2012 23:10:41 +0000 (23:10 +0000)
* 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.

gold/ChangeLog
gold/layout.cc
gold/output.cc

index e6ee0d6b3e74a3731d97430141962a26e0f7178a..ed1a8d4f7f1c6b8c39856cb3950886b21a2ba335 100644 (file)
@@ -1,3 +1,13 @@
+2012-09-11  Alan Modra  <amodra@gmail.com>
+
+       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.
+
 2012-09-11  Alan Modra  <amodra@gmail.com>
 
        * output.h (Output_data_got::add_global_tls, add_local_tls,
index 808dd944328196c719cab0e8cb6e69d1cf673b84..86e39ebcf688949c43e1f1ba7642260eda2fabcf 100644 (file)
@@ -3420,6 +3420,8 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg,
                  *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 d75579b6152b5e574508cf5de315390ce0773cf6..fa6d8081907e558f8857d6022bd6d836b57caab3 100644 (file)
@@ -4239,7 +4239,7 @@ Output_segment::set_section_addresses(Layout* layout, bool reset,
   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))
@@ -4294,7 +4294,7 @@ Output_segment::set_section_addresses(Layout* layout, bool reset,
       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);
@@ -4604,7 +4604,7 @@ Output_segment::set_offset(unsigned int increase)
   // 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())
        {