From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: Kasper Peeters Cc: binutils@sourceware.cygnus.com, Ian Lance Taylor Subject: Re: adding rpath to existing executable Date: Thu, 01 Jul 1999 00:00:00 -0000 Message-id: <19990620165749.C4699@cygnus.com> References: <14187.31671.962776.583046@hopf.amtp.cam.ac.uk> <19990619164906.24379.qmail@daffy.airs.com> <14189.24404.190234.153358@hopf.amtp.cam.ac.uk> <14189.24404.190234.153358@hopf.amtp.cam.ac.uk> X-SW-Source: 1999-q2/msg00293.html 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~