diff options
author | Cary Coutant <ccoutant@google.com> | 2015-01-09 15:55:50 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2015-01-09 15:58:39 -0800 |
commit | a5cd8f05ca759fdb9b27fc98a08edb5f85369ad9 (patch) | |
tree | 4d9359f22a85f5549398a32786d3eacbae11453b /gold/layout.cc | |
parent | 6bf045cd32d07ae55d7eec8ff94bd937c6bb2bce (diff) | |
download | binutils-gdb-a5cd8f05ca759fdb9b27fc98a08edb5f85369ad9.tar.gz |
Don't align start of segment unless alignment is larger than page size.
This fixes an issue where a page-aligned data section, combined with -z relro,
could lead to a gap between text and data segments larger than a page, and
we would fail to overlap the segments in the file.
gold/
* layout.cc (Layout::set_segment_offsets): Don't align start of segment
unless alignment is larger than page size.
Diffstat (limited to 'gold/layout.cc')
-rw-r--r-- | gold/layout.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index acc03b21e19..bcdaac825db 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -3524,7 +3524,9 @@ Layout::set_segment_offsets(const Target* target, Output_segment* load_seg, // put them on different pages in memory. We will revisit this // decision once we know the size of the segment. - addr = align_address(addr, (*p)->maximum_alignment()); + uint64_t max_align = (*p)->maximum_alignment(); + if (max_align > abi_pagesize) + addr = align_address(addr, max_align); aligned_addr = addr; if (load_seg == *p) |