From mboxrd@z Thu Jan 1 00:00:00 1970 From: law@redhat.com To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: objc/2902: collect2 doesn't find ctors/dtors in shared libraries under hpux10.20 Date: Wed, 13 Jun 2001 08:46:00 -0000 Message-id: <20010613154602.17534.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00565.html List-Id: The following reply was made to PR objc/2902; it has been noted by GNATS. From: law@redhat.com To: dave.anglin@nrc.ca Cc: gcc-gnats@gcc.gnu.org Subject: Re: objc/2902: collect2 doesn't find ctors/dtors in shared libraries under hpux10.20 Date: Tue, 12 Jun 2001 18:52:50 -0700 In message <20010522184444.25021.qmail@sourceware.cygnus.com>you write: > > >Number: 2902 > >Category: objc > >Synopsis: collect2 doesn't find ctors/dtors in shared libraries unde > r hpux10.20 > >Confidential: no > >Severity: serious > >Priority: medium > >Responsible: unassigned > >State: open > >Class: sw-bug > >Submitter-Id: net > >Arrival-Date: Tue May 22 11:46:00 PDT 2001 > >Closed-Date: > >Last-Modified: > >Originator: Dave Anglin > >Release: gcc version 3.0 20010518 (prerelease) > >Organization: > >Environment: > # ../../gcc/configure --host=hppa1.1-hp-hpux10.20 --target=hppa1.1-hp-hpux > 10.20 --srcdir=../../gcc --with-gcc-version-trigger=/xxx/gnu/gcc-3.0/gcc/ve > rsion.c --with-gnu-as --enable-shared --enable-threads --enable-debug=no > >Description: > The symptom is a large number of failures in the testsuite with the followi > ng error: > > Executing on host: /xxx/gnu/gcc-3.0/objdir/gcc/xgcc -B/xxx/gnu/gcc-3.0/objd > ir/gcc/ /xxx/gnu/gcc-3.0/gcc/testsuite/objc/execute/_cmd.m -w -O -I/xxx/ > gnu/gcc-3.0/gcc/testsuite/../../libobjc -L/xxx/gnu/gcc-3.0/objdir/hppa1.1-h > p-hpux10.20/libobjc/.libs -lobjc -lm -fPIC -o /xxx/gnu/gcc-3.0/objdir/gc > c/testsuite/_cmd.x > (timeout = 300) > PASS: objc/execute/_cmd.m compilation, -O > objc runtime: cannot find class Object > FAIL: objc/execute/_cmd.m execution, -O > > In debugging this, I found that the constructors to build the > classes Object and NXConstantString don't run when the application > is linked with a shared libobjc. This is apparently because > collect2 can't determine that these constructors are needed. > Here is part of the output generated by collect2 with `-debug' > linking _cmd.x: > > /usr/ccs/bin/ld -L/lib/pa1.1 -L/usr/lib/pa1.1 -z -u main -o /xxx/gnu/gcc-3. > 0/objdir/gcc/testsuite/_cmd.x /usr/ccs/lib/crt0.o -L/xxx/gnu/gcc-3.0/objdir > /hppa1.1-hp-hpux10.20/libobjc/.libs -L/xxx/gnu/gcc-3.0/objdir/gcc -L/usr/lo > cal/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.0 -L/usr/ccs/bin -L/usr/ccs/lib -L/o > pt/langtools/lib -L/usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.0/../../.. > /var/tmp/ccapeMug.o -lobjc -lm -lgcc -lc -lgcc > /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.0/../../../../hppa1.1-hp-hpu > x10.20/bin/nm -n /xxx/gnu/gcc-3.0/objdir/gcc/testsuite/_cmd.x > > nm output with constructors/destructors. > 000025e8 T _GLOBAL__I_main > > /usr/ccs/bin/chatr /xxx/gnu/gcc-3.0/objdir/gcc/testsuite/_cmd.x > > ldd output with constructors/destructors. > dynamic /xxx/gnu/gcc-3.0/objdir/hppa1.1-hp-hpux10.20 > /libobjc/.libs/libobjc.sl.1 > dynamic /usr/lib/libc.1 > > /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.0/../../../../hppa1.1-hp-hpu > x10.20/bin/nm -n /xxx/gnu/gcc-3.0/objdir/hppa1.1-hp-hpux10.20/libobjc/.libs > /libobjc.sl.1 > > nm output with constructors/destructors. > 00017aa0 T _GLOBAL__I___objc_linking > 00017ad0 T _GLOBAL__I___objc_linking > 00018210 T _GLOBAL__I_.._.._.._libobjc_NXConstStr.mSFndDa > 00018228 T _GLOBAL__I_.._.._.._libobjc_NXConstStr.mSFndDa > 0001a1e0 T _GLOBAL__I_.._.._.._libobjc_Object.mOXKa8a > 0001a1f8 T _GLOBAL__I_.._.._.._libobjc_Object.mOXKa8a > 0001b058 T _GLOBAL__I_.._.._.._libobjc_Protocol.mxvicuc > 0001b070 T _GLOBAL__I_.._.._.._libobjc_Protocol.mxvicuc > > /usr/local/lib/gcc-lib/hppa1.1-hp-hpux10.20/3.0/../../../../hppa1.1-hp-hpu > x10.2 > 0/bin/nm -n /usr/lib/libc.1 > > nm output with constructors/destructors. > > 1 constructor(s) found > 0 destructor(s) found > 0 frame table(s) found > [Leaving /xxx/gnu/gcc-3.0/objdir/gcc/testsuite/_cmd.x] > >How-To-Repeat: > Configure with `--enable-shared'. > >Fix: > > >Release-Note: > >Audit-Trail: > >Unformatted: I'm not sure which constructors you're claiming need to be fired and where they're defined. For a shared library all the ctors/dtors should be fired by the shared library's ctor/dtor. ie, there should be a ctor for the library as a whole which fires off all the ctors/dtors within the library. jeff