Help needed - defining the output section order

Segher Boessenkool segher@kernel.crashing.org
Wed Aug 24 08:12:00 GMT 2005


>> Sadly this only results in
>> "Not enough room for program headers (allocated 5, need 6)" and "final
>> link failed: Bad value".
>
> Ah well, that is because your new linker script is too simple.  There 
> is a section in the linker documentation that talks about this 
> problem:

[snip]

> So what you probably need to do is to add a PHDRS command to your 
> linker script.

It might be enough if you prevent ld from creating the magic stack
segment behind its own back, e.g., I have this in my Makefiles:

%.o: %.c
         $(CC) $(CFLAGS) -c $< -o $@ && $(OBJCOPY) -R .note.GNU-stack $@

(using /DISCARD/ in your linker script is _not_ enough).


Segher



More information about the Binutils mailing list