LD_PRELOAD and dlopen

Andreas Jaeger aj@suse.de
Tue May 29 22:00:00 GMT 2001


"Stephen Done at home" <stephen.done@cw.com> writes:

n> Hi Andreas,
> 
> That did indeed fix the problem. If you have time, could you give a very
> quick explanation of why, and also perhaps why gcc acted differently under
> Solaris with the 'undefined versioned symbol name dlopen@@GLIBC_2.1' error.

ld searches definitions in the order given on the command line.

So when you did:
gcc -Wall -ldl -fPIC -shared -o preload.so preload.c
/usr/bin/ld: preload.so: undefined versioned symbol name dlopen@@GLIBC_2.1
/usr/bin/ld: failed to set dynamic section sizes: Bad value

ld did not search in -ldl for missing function from preload.

Just run gcc -Wl,-verbose to see the difference and how ld works.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj



More information about the Libc-alpha mailing list