From 1c4cd9c960a712116312670da9844f9df8af8e1c Mon Sep 17 00:00:00 2001 From: Alexander Ivchenko Date: Thu, 6 Jun 2013 15:16:46 +0400 Subject: [2.21], [2.22], [2.23] Backport of the patch for fixing large symbol alignment. 2013-06-05 Alexander Ivchenko gold/ * layout.cc (Layout::set_segment_offsets): Taking care of the case when the maximum segment alignment is larger than the page size. * testsuite/Makefile.am (large_symbol_alignment): Test that Gold correctly aligns the symbols with large alignemnt. * testsuite/Makefile.in: Regenerate. * testsuite/large_symbol_alignment.cc: New file. Change-Id: I2fe5b73b9e76050f0f42bbbc9086d0d5824c0020 Signed-off-by: Alexander Ivchenko --- binutils-2.22/gold/layout.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'binutils-2.22/gold/layout.cc') diff --git a/binutils-2.22/gold/layout.cc b/binutils-2.22/gold/layout.cc index fbad2723..fb53c217 100644 --- a/binutils-2.22/gold/layout.cc +++ b/binutils-2.22/gold/layout.cc @@ -3327,7 +3327,13 @@ 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); + { + // Here we are also taking care of the case when + // the maximum segment alignment is larger than the page size. + off = align_file_offset(off, addr, + std::max(abi_pagesize, + (*p)->maximum_alignment())); + } else { // This is -N or -n with a section script which prevents -- cgit v1.2.3