objc/2902: collect2 doesn't ...: libtool should use collect2?

John David Anglin dave@hiauly1.hia.nrc.ca
Thu May 24 15:50:00 GMT 2001


> Executing on host: /xxx/gnu/gcc-3.0/objdir/gcc/xgcc -B/xxx/gnu/gcc-3.0/objdir/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-hp-hpux10.20/libobjc/.libs  -lobjc -lm   -fPIC -o /xxx/gnu/gcc-3.0/objdir/gcc/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

I started looking into the cause of the above.  The problem is caused
by using libtool rather than gcc to link libobjc.sl.  Libtool
directly invokes `ld' to link the objects in the shared library.  On the
otherhand, gcc under hpux will invoke collect2 to link the objects.
Collect2 will notice that the objects contain constructors/destructors
and add initializer and finalizer functions to the shared library.
When an application is linked with the shared library using gcc, collect2
will add these functions to the constructor/destructor list for the 
application and all will be well (hopefully).

This is a regression from the previous release which didn't use libtool.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)



More information about the Gcc-bugs mailing list