This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] 2015-01-25 Cary Coutant <ccoutant at google dot com>


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5485698ae4679bd18a37f8520a17be8b760e5a18

commit 5485698ae4679bd18a37f8520a17be8b760e5a18
Author: Cary Coutant <ccoutant@google.com>
Date:   Sun Jan 25 17:31:32 2015 -0800

    2015-01-25  Cary Coutant  <ccoutant@google.com>
    
    gold/
    	* output.cc (Output_segment::set_section_addresses): Fix calculation
    	of size of relro segment.

Diff:
---
 gold/ChangeLog |  5 +++++
 gold/output.cc | 15 ++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gold/ChangeLog b/gold/ChangeLog
index 48f46ce..946504a 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-25  Cary Coutant  <ccoutant@google.com>
+
+	* output.cc (Output_segment::set_section_addresses): Fix calculation
+	of size of relro segment.
+
 2015-01-22  Alan Modra  <amodra@gmail.com>
 
 	* powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
diff --git a/gold/output.cc b/gold/output.cc
index 9a51131..e9dd522 100644
--- a/gold/output.cc
+++ b/gold/output.cc
@@ -4311,8 +4311,8 @@ Output_segment::set_section_addresses(const Target* target,
 	      else
 		{
 		  // FIXME: This could be faster.
-		  (*p)->set_address_and_file_offset(addr + relro_size,
-						    off + relro_size);
+		  (*p)->set_address_and_file_offset(relro_size,
+						    relro_size);
 		  relro_size += (*p)->data_size();
 		  (*p)->reset_address_and_file_offset();
 		}
@@ -4332,11 +4332,12 @@ Output_segment::set_section_addresses(const Target* target,
 
       // Align to offset N such that (N + RELRO_SIZE) % PAGE_ALIGN == 0.
       uint64_t desired_align = page_align - (aligned_size % page_align);
-      if (desired_align < *poff % page_align)
-	*poff += page_align - *poff % page_align;
-      *poff += desired_align - *poff % page_align;
-      addr += *poff - orig_off;
-      orig_off = *poff;
+      if (desired_align < off % page_align)
+	off += page_align;
+      off += desired_align - off % page_align;
+      addr += off - orig_off;
+      orig_off = off;
+      *poff = off;
     }
 
   if (!reset && this->are_addresses_set_)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]