This is the mail archive of the binutils@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]

[GOLD] load segment alignment


When testing simple ppc64 shared libs linked by gold, I found glibc
ld.so complaining with "ELF load command alignment not page-aligned".
gold should always use the ABI mandated page size (-z max-page-size)
rather than the common page size (-z common-page-size) when setting
alignment for segments.  The only real utility of the common page size
value is in tweaking the start address of a read/write segment
following a read-only segment in order to use fewer memory pages.
This patch cures the problem, and a similar one in
relaxation_loop_body.  OK to apply?

	* layout.cc (Layout::set_segment_offsets): Set p_align to
	abi_pagesize, not common_pagesize.
	(Layout::relaxation_loop_body): Similarly use abi_pagesize
	to determine whether file header can go in segment.

Index: gold/layout.cc
===================================================================
RCS file: /cvs/src/src/gold/layout.cc,v
retrieving revision 1.236
diff -u -p -r1.236 layout.cc
--- gold/layout.cc	24 Aug 2012 18:35:34 -0000	1.236
+++ gold/layout.cc	30 Aug 2012 01:36:54 -0000
@@ -2318,7 +2318,7 @@ Layout::relaxation_loop_body(
   // compatible with putting the segment headers and file headers into
   // that segment.
   if (parameters->options().user_set_Ttext()
-      && parameters->options().Ttext() % target->common_pagesize() != 0)
+      && parameters->options().Ttext() % target->abi_pagesize() != 0)
     {
       load_seg = NULL;
       phdr_seg = NULL;
@@ -3330,7 +3330,7 @@ Layout::set_segment_offsets(const Target
 
 	  if (!parameters->options().nmagic()
 	      && !parameters->options().omagic())
-	    (*p)->set_minimum_p_align(common_pagesize);
+	    (*p)->set_minimum_p_align(abi_pagesize);
 
 	  if (!are_addresses_set)
 	    {

-- 
Alan Modra
Australia Development Lab, IBM


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