A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

May 13, 2011

LDS Script Error: insufficient program headers


I am building a project using the GNU / Cygwin tool chain, cross compiled for the MIPS-ELF.

My problem involves the linker, ld (really mips-elf-ld). I receive this error
message, when I build.

project.out: Not enough room for program headers, try linking with -N
mips-elf-ld: final link failed: Bad value
dmake.exe: Error code 129, while making '\project.out'

I modified a sample that I was given, the sample does not for whatever reason have to deal with
insufficent headers, so the LDS mapping file does not have anything
there that I can use. I am trying on my own to solve the problem, but
so far no luck.

Further Information: Adding in the line ". = SIZEOF_HEADERS;" as the
first line in the SECTIONS block, changes the error message to saying
that the linker allocated 3 headers but needs space for 16. What do I
have to add to the LDS file to solve the problem?

I tried to add a PHDRS block, as the unversal example does
not give enough information to tailor it to my needs. The internet example is:

headers PT_PHDR PHDRS ;
interp PT_INTERP ;
data PT_LOAD ;
dynamic PT_DYNAMIC ;

Adding this block makes the problem worse or at the least does not
solve the problem. I tried adding in various things to this block,
after adding it, but got nowhere.

Is there some way to just state that number, since I now know that I
need 16 headers. I did research and know that one header is 32-bytes.

Thanks in advance,


Click Here!