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

Re: ld: Not enough room for program headers


Hi Franco,

: > /usr/bin/ld: avi_new: Not enough room for program headers (allocated 6, need 7)
: > 
: > After doing a bit of research, I discovered that this is something
: > to do with SIZEOF_HEADERS in the linker script, and Michal
: > suggested I try some newer versions of binutils to see if the
: > problem has been fixed. 

This is probably not a bug per se, but more of a problem with your
linker script.  The linker documentation (ld/ld.texinfo) has this to
say:

  SIZEOF_HEADERS
    Return the size in bytes of the output file's headers.
    This is information which appears at the start of the
    output file.  You can use this number when setting the
    start address of the first section, if you choose, to
    facilitate paging.

  not enough room for program headers
    When producing an ELF output file, if the linker script
    uses the SIZEOF_HEADERS builtin function, the linker
    must compute the number of program headers before it has
    determined all the section addresses and sizes.  If the
    linker later discovers that it needs additional program
    headers, it will report an error @samp{not enough room
    for program headers}.  To avoid this error, you must
    avoid using the SIZEOF_HEADERS function, or you must
    rework your linker script to avoid forcing the linker
    to use additional program headers, or you must define
    the program headers yourself using the PHDRS command.

So you need to change your script to either remove the use of
SIZEOF_HEADERS (if you do not really need it) or to add a PHDRS
declaration.

: > After trying a few version of binutils ( 2.10.0.12, 18 and 24) to
: > no avail, I discovered that 2.9.5.0.22-6 worked. This has more to
: > do with the version of ld I'd imagine, the latter version of
: > binutils has ld 2.9.5, whereas all the others I tried have ld
: > 2.10.90. 

It is probably a bug in the 2.9.5... release that it did not produce
this warning.

Cheers
	Nick

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