gcc 3.0 missing __dso_handle in libstdc++

Andi Kleen ak@muc.de
Sun May 27 16:18:00 GMT 2001


On Sun, May 27, 2001 at 10:20:34PM +0200, Alexandre Oliva wrote:
> On May 27, 2001, Andi Kleen <ak@muc.de> wrote:
> 
> > __dso_handle seems to declared in crtstuff.c. It seems to forget to link
> > that in (?) 
> 
> crtstuff.c is compiled into crtbegin.o and crtend.o, which are both
> linked in.  It must be something else.

it seems to be somewhat defined:

fred:/pkg/gcc-3.0/lib% nm libstdc++.so.3 | grep dso_handle
0007e2c0 d __dso_handle

('d' is local according to the vague nm documentation) 

and it's defined in the hello world executable:

fred:~/wsrc% nm hello  | grep dso
0804c72c D __dso_handle
fred:~/wsrc% 

but the dynamic linker doesn't find it.

I guess it's caused by the following in crtstuff.o:

/* Declare the __dso_handle variable.  It should have a unique value
   in every shared-object; in a main program its value is zero.  The
   object should in any case be protected.  This means the instance
   in one DSO or the main program is not used in another object.  The
   dynamic linker takes care of this.  */

/* XXX Ideally the following should be implemented using
       __attribute__ ((__visibility__ ("hidden")))
   but the __attribute__ support is not yet there.  */
#ifdef HAVE_GAS_HIDDEN
asm (".hidden\t__dso_handle");
#endif

#ifdef CRTSTUFFS_O
void *__dso_handle = &__dso_handle;
#else
void *__dso_handle = 0;
#endif

but seems that doesn't work properly in glibc 2.1 and binutils 2.9.5.0 (hj lu versions I think)
It may be a dynamic linker bug?

-Andi



More information about the Gcc-bugs mailing list