powerpc64-linux build, problem building glibc --with-__thread

Alan Modra amodra@bigpond.net.au
Fri Jan 9 05:34:00 GMT 2004


On Fri, Jan 09, 2004 at 02:56:32PM +1030, Alan Modra wrote:
> On Thu, Jan 08, 2004 at 03:52:04PM -0800, Janis Johnson wrote:
> > The big problem with the powerpc64-linux build is that the glibc build
> > fails because elf/sln fails to link when glibc is configured using
> > --with-__thread.  The message is "Not enough room for program headers:
> > (allocated 4, need 5)".
> 
> It seems to be a bug related to Jakub's PT_GNU_STACK changes.

It was.  The trouble was that the initial section layout done for ppc64
tls optimization calculated a value for SIZEOF_HEADERS and cached it.
Later, in size_dynamic_sections, we figure out whether we need a
PT_GNU_STACK header.  If we do, then the cached value for SIZEOF_HEADERS
is wrong.

Jakub, Olaf, would you please see that this patch goes into your next
RedHat and SuSE binutils releases?

	* emultempl/ppc64elf.em (ppc_before_allocation): Clear cached
	program_header_size.

Index: ld/emultempl/ppc64elf.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/ppc64elf.em,v
retrieving revision 1.24
diff -u -p -r1.24 ppc64elf.em
--- ld/emultempl/ppc64elf.em	4 Nov 2003 23:11:23 -0000	1.24
+++ ld/emultempl/ppc64elf.em	9 Jan 2004 05:29:42 -0000
@@ -25,6 +25,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
 
 #include "ldctor.h"
 #include "libbfd.h"
+#include "elf-bfd.h"
 #include "elf64-ppc.h"
 
 /* Fake input file for stubs.  */
@@ -117,6 +118,8 @@ ppc_before_allocation (void)
 	      return;
 	    }
 
+	  /* We must not cache anything from the preliminary sizing.  */
+	  elf_tdata (output_bfd)->program_header_size = 0;
 	  lang_reset_memory_regions ();
 	}
     }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list