adding rpath to existing executable

Richard Henderson rth@cygnus.com
Thu Jul 1 00:00:00 GMT 1999


On Sun, Jun 20, 1999 at 10:38:28PM +0100, Kasper Peeters wrote:
> Is there a _complicated_ way to add an RPATH to an already existing
> executable using binutils? 

I don't think so.

> But I find it hard to believe that
> nobody else has had a need for such a program before. 

I've seen such a program before, but it was written to directly
manipulate the ELF file structures.

> Is libbfd capable of doing this or is more trickery involved that I am
> not aware of?

There has to be room in one of the existing loadable segments
(usually at the end of the readonly segment containing .text),
and if there isn't, you have to add a new loadable segment
somewhere in the address space.  This can also mean shifting the
loadable segments around in the executable image to make room.

The general case is exceedingly ugly.


r~


More information about the Binutils mailing list