Subject: Re: how do I adjust rpath?
To: Eric Haszlakiewicz <erh@jodi.nimenees.com>
From: Luke Mewburn <lukem@NetBSD.org>
List: netbsd-help
Date: 03/30/2005 10:48:13
--x7gJcYyRf5ZnuMVj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Mar 29, 2005 at 12:19:20PM -0600, Eric Haszlakiewicz wrote:
  | > If strlen(newrpath) <=3D strlen(origrpath), just binary edit the file.
  | > No special tools are required.
  | >=20
  | > Otherwise, you'll have to relink from the original .o files.
  | > The tools Jeremy refers to won't help here.
  |=20
  | 	ugh.  That's not very helpful when I don't have the .o files.
  | Given ELF's reliance on paths in the binary I would think that being ab=
le
  | to easily change that would have been an important thing to be able to
  | do, but I guess not.
  |
  | 	I think I can hack something together with a combination of
  | objdump, elfsh and that rpath changing program to do what I want, but
  | it seems like making ld do it would make more sense.  I haven't even
  | glanced at that code though.  Does anyone know how hard it would be
  | to convince ld to pay attention to the rpath arg when given a binary
  | instead of .o's for input?

I believe that it will only work if the binary was linked relocatable
(ld -r), but don't quote me.  (There are NetBSD developers who
_are_ ELF gurus.  They're probably not on this mailing list though.
tech-toolchain is probably a better place to ask this type of question.)

You could try setting LD_RUN_PATH in a wrapper script.

You could try hacking /etc/ld.so.conf, although that's a sledgehammer
that affects all applications.


BTW: Solaris 8 (?) added support for "crle(1)", which allows you to
change the default search paths for ld.so, and AFAICT, on a
per-application bases.  The manual page for that may be an
interesting inspiration for providing similar functionality
to our ld.elf_so.  It wouldn't be the first time we got inspiration
from Solaris :)

--x7gJcYyRf5ZnuMVj
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iD8DBQFCSfdNpBhtmn8zJHIRAuW7AKCDvIHrCijPQx0qsPTCOVd1QfhcQwCg1psa
C5wzLsXuNVaAzSCHEIrbEB0=
=Hgmk
-----END PGP SIGNATURE-----

--x7gJcYyRf5ZnuMVj--