ld linking behaviour

Edward Peschko horos11@gmail.com
Fri Jun 11 23:36:00 GMT 2010


When I link with a shared library, for example:

 env LD_RUN_PATH="/usr/lib" /usr/bin/gcc -shared -fPIC
-L/usr/local/lib -Wl,-rpath,/home/y/lib Libconfig.o -o
blib/arch/auto/Conf/Libconfig/Libconfig.so -L/usr/lib -L/usr/local/lib

the ld command follows the version, and links to the specific version
of the library, not the library itself. An ldd dump shows :

prompt% ldd blib/arch/auto/Conf/Libconfig/Libconfig.so
        linux-gate.so.1 =>  (0xffffe000)
        libconfig.so.8 => /usr/lib/libconfig.so.8 (0xf7fe2000)
        libc.so.6 => /lib/tls/libc.so.6 (0xf7eb7000)
        /lib/ld-linux.so.2 (0x56555000)

How can I make it so that the ld command instead links to the
libconfig.so library itself (so that if a newer, binary compatible,
version of libconfig comes out it can use it transparently)?

I can do:

env LD_PRELOAD=/usr/lib/libconfig.so ldd

and get the desired result, but I'd rather not deal with extra
environment settings..

Thanks much,


More information about the Binutils mailing list