I can't get the --inhibit-rpath option to ld-linux.so.2 to work.
ObDocPatch:
Index: rtld.c
===================================================================
RCS file: /cvs/glibc/libc/elf/rtld.c,v
retrieving revision 1.154
diff -u -r1.154 rtld.c
--- rtld.c 1999/08/19 23:17:32 1.154
+++ rtld.c 2000/01/17 04:05:37
@@ -454,7 +454,7 @@
\n\
--list list all dependencies and how they are resolved\n\
--verify verify that given object really is a dynamically linked\n\
- object we get handle\n\
+ object we can handle\n\
--library-path PATH use given PATH instead of content of the environment\n\
variable LD_LIBRARY_PATH\n\
--inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\
shell transcript follows:
(martin@lasker) ~/src/tt $ gcc29 -shared -o libX11.so.6 -Wl,--soname=libX11.so.6 main.c
(martin@lasker) ~/src/tt $ cat main.c
#include <stdio.h>
int XOpenDisplay (char *s)
{
printf ("my own XOpenDisplay\n");
}
(martin@lasker) ~/src $ cat lib.c
#include <stdio.h>
int main (int argc, char *argv[])
{
XOpenDisplay ("hello world\n");
return 0;
}
(martin@lasker) ~/src $ gcc29 -Wl,-rpath=/home/martin/src/tt lib.c -L /home/martin/src/tt
-lX11
(martin@lasker) ~/src $ ./a.out
my own XOpenDisplay
(martin@lasker) ~/src $ LD_PRELOAD=/usr/X11R6/lib/libX11.so.6 ./a.out
(martin@lasker) ~/src $ $cdi/glibc-2.1.2/elf/ld-linux.so.2 --inhibit-rpath ./a.out
./a.out
my own XOpenDisplay
(martin@lasker) ~/src $ LD_DEBUG=libs $cdi/glibc-2.1.2/elf/ld-linux.so.2 --inhibit-rpath
./a.out ./a.out
24393: find library=libX11.so.6; searching
24393: search path=/home/martin/src/tt/i686:/home/martin/src/tt (RPATH from file
./a.out)
24393: trying file=/home/martin/src/tt/i686/libX11.so.6
24393: trying file=/home/martin/src/tt/libX11.so.6
24393:
24393: find library=libc.so.6; searching
24393: search path=/home/martin/src/tt (RPATH from file ./a.out)
24393: trying file=/home/martin/src/tt/libc.so.6
24393: search cache=/etc/ld.so.cache
24393: trying file=/lib/libc.so.6
24393:
24393:
24393: calling init: /lib/libc.so.6
24393:
24393:
24393: calling init: /home/martin/src/tt/libX11.so.6
24393:
24393:
24393: initialize libc
24393:
24393:
24393: initialize program: ./a.out
24393:
24393:
24393: transferring control: ./a.out
24393:
my own XOpenDisplay
24393:
24393: calling fini: /home/martin/src/tt/libX11.so.6
24393:
24393:
24393: calling fini: /lib/libc.so.6
24393: