Bug 7292 - ld fails to link large program
ld fails to link large program
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: binutils (Show other bugs)
6.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-11-24 11:00 EST by richieb
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-02-04 12:48:43 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description richieb 1999-11-24 11:00:21 EST
When I try to link a large program I get this error:

/usr/bin/ld: ./ise_testall: Not enough room for program headers (allocated
6, need 7)
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make: *** [ise_testall] Error 1


I'm not sure what this error means. When I reduce the size of the program
by recompiling with fewer internal tests, the link works OK.

Any suggestions?


...richie
Comment 1 Jim Kingdon 1999-11-29 12:39:59 EST
Well, I can offer a partial answer (from a newer version of the binutils
manual):

 When producing an ELF output file, if the linker script uses the
 @code{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 @code{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 @code{PHDRS}
 command (@pxref{PHDRS}).

The linker script in question is presumably one of the default ones
(in /usr/lib/ldscripts).  The question is what is in your test programs
to make them want that 7th program header (if I run "objdump -p /bin/ls"
it shows 6 program headers).  I'm not sure exactly what to look for, but
something along the lines of asm() statements with ".section" would
be one example of the kind of thing which might be relevant.
Comment 2 Cristian Gafton 2000-02-04 12:48:59 EST
It looks like in this case a customized linker script is needed (like emacs
does). I suggest you report the problem to the binutils maintainers if you'd
like the default values changed.

Note You need to log in before you can comment on or make changes to this bug.