link script question - adding sections at specific addresses

Alan Modra alan@linuxcare.com.au
Thu Aug 3 18:08:00 GMT 2000


On Thu, 3 Aug 2000, Becky Gill wrote:

> 1) Can someone explain how to add another text section to an elf32 ppc linux
> executable at a specific address?  I need to add a new section of code that is
> located several pages away from the rest of an application's text and data. 
> I've done a lot of playing around with the default elf32ppclinux.x script, but
> I keep getting the "not enough room for program headers" message, depending on
> where I put it.

As a first step, try replacing SIZEOF_HEADERS in your script with a fixed
constant.  Choose a value somewhat larger than the current header size - 
you seem to have already discovered what this is :-)

If this still gives linker errors, you will need to set up your own
program headers.  Have a look at "Node: PHDRS" in the ld info
documentation.  "readelf -l" will let you look at existing file headers.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.




More information about the Binutils mailing list