This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Testcase for dlopen bug
- From: "H . J . Lu" <hjl at lucon dot org>
- To: GNU C Library <libc-alpha at sources dot redhat dot com>
- Date: Fri, 31 May 2002 16:33:03 -0700
- Subject: Re: Testcase for dlopen bug
- References: <20020531155204.A30676@lucon.org>
On Fri, May 31, 2002 at 03:52:04PM -0700, H . J . Lu wrote:
> This is the smallest testcase I can find:
>
> # make
> gcc --shared -o libbar.so libbar.S -fPIC -g
> gcc --shared -o libfoo.so glerr.c -fPIC -g lib/libGLU.so
> gcc --shared -o foo.so foo.S libbar.so libfoo.so -fPIC -g
> gcc -g -c -o main.o main.c
> gcc -o main -Wl,-R,.:lib main.o -ldl
> ./main foo.so 2>&1
> Loading: foo.so: Failed: ðáqBðáqBo: shared object not open
> make: *** [all] Error 1
>
> You may have to run it on RedHat 7.x with libGLU installed to see it
> since it uses libGLU and libstdc++-libc6.2-2.so.3.
>
I think the problem is in dl-open.c. When something goes wrong, we
do
/* Increment open counters for all objects since this
sometimes has not happened yet. */
if (args.map->l_opencount == 0)
for (i = 0; i < args.map->l_searchlist.r_nlist; ++i)
++args.map->l_searchlist.r_list[i]->l_opencount;
But it doesn't cover some complex cases where you can have circular
dependencies among the object being dlopened and objects on its
DT_NEEDED list. It is quite complex. I don't know for sure how we
want to deal with it.
H.J.