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]
Other format: [Raw text]

Re: Defining a section that isn't file-backed


Hi Mike,

> I've tried this but unfortunately get:
>
> gcc -o lds1 -Wl,-T,lds1.ldscript -lm -ldl -lncurses -lpthread -lssl -lpam -luuid -ltermcap lds1.c
> /usr/bin/ld: lds1: Not enough room for program headers (allocated 7, need 8)

Ah yes, the dreaded "not enough room for program headers" problem.
This is documented in the linker manual, so I suggest that you have a
look there.

The best solution is create and allocate your own program headers in
the linker script using the PHDR command.  I am attaching a script
which demonstrates this, although you will need to modify it for your
own circumstances.  For one thing it only defines 6 program headers
and according the linker error message you are going to need at least
8.  Also it does not map all sections to their proper segments (I was
lazy), so you will need to do that.  If you run "readelf -Sl" on your
program, without the .empty section, you should be able to find out
which segments you need and which sections should be allocated to
them.

Cheers
        Nick
        

Attachment: script.t
Description: linker script


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