This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
dlopen question
- From: yuval at aduva dot com
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 4 Jun 2004 22:52:14 +0300
- Subject: dlopen question
Hello,
I wrote a small shared library that has a global instance, named 'error', of a
certain dummy class.
When I try to dlopen this library, it works fine only on glibc 2.2, while on
glibc 2.3, it crashes when trying to construct the object.
What I managed to find out is that there's a symbol called 'error' in the 2
given libc's. In glibc 2.2, ld binds the 'error' symbol to my shared object,
while the ld from glibc 2.3 binds that symbol to libc (and then my app segfaults).
I know that changing the name of my object solves the problem, but I'd like to
know what causes this behaviour ?
Here's the output from LD_DEBUG
glibc 2.2 (ld binds the 'error' symbol as expected to my shared object)
27472: symbol=error; lookup in file=./tt
27472: symbol=error; lookup in file=/lib/libdl.so.2
27472: symbol=error; lookup in file=/usr/lib/libstdc++-libc6.2-2.so.3
27472: symbol=error; lookup in file=/lib/i686/libm.so.6
27472: symbol=error; lookup in file=/lib/i686/libc.so.6
27472: symbol=error; lookup in file=/lib/ld-linux.so.2
27472: symbol=error; lookup in file=./t.so
27472: binding file ./t.so to ./t.so: normal symbol `error'
glibc 2.3 (ld binds the 'error' symbol to the 'error' in libc)
10334: symbol=error; lookup in file=./tt
10334: symbol=error; lookup in file=/lib/tls/libdl.so.2
10334: symbol=error; lookup in file=/usr/lib/libstdc++-libc6.2-2.so.3
10334: symbol=error; lookup in file=/lib/tls/libm.so.6
10334: symbol=error; lookup in file=/lib/tls/libc.so.6
10334: binding file ./t.so to /lib/tls/libc.so.6: normal symbol `error'
Same behaviour occurs when using the non-tls version of libc (2.3)
Any ideas ?
Thanks.
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/