ld error: "Not enough room for program headers (allocated 3,need 4)"

Alan Modra alan@linuxcare.com.au
Thu May 25 00:28:00 GMT 2000

On Thu, 25 May 2000, Kammerloher Josef wrote:

> I try to create a shared library (size 20-30 MB) on Linux (SuSe 6.4). 
> gcc version 2.95.2 19991024 (release)  
> GNU ld version 2.9.5 (with BFD
> The linker fails with
> Not enough room for program headers (allocated 3, need 4)
> /usr/i486-suse-linux/bin/ld. final link failed: Bad value
> collect2: ld returned 1 exit status
> I studied the man pages and all newsgroups, and I asked some newsgroups, but
> had no success.

Here are some things to do:
o Study the info pages that come with ld.
  See ld.info, Node: Builtin Functions, SIZEOF_HEADERS. 
o Compare the elf linker scripts (probably in
  /usr/i486-suse-linux/lib/ldscripts/ on your system) against standard
  ones.  eg. from ftp.varesearch.com/pub/support/hjl/binutils/  If they
  are different, try the standard scripts.
o Delete SIZEOF_HEADERS from your linker script, and replace with a fixed
  number.  Try 1024.
o If all this fails, post a bug report to binutils@sourceware.cygnus.com

Linuxcare.  Support for the Revolution.

More information about the Gcc-bugs mailing list