This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


> > > 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.  
> > [...] 

Here is a libtool fix for the above problem.  It changes libtool to use
`gcc -shared' for linking shared archives under hpux when $with_gcc = yes.
However, this may only be the tip of the ice berg.  The same problem
may apply to quite a few other oses.  However, I don't know enough to
provide a more general fix.

Unfortunately, it doesn't resolve all the issues with libobjc under hpux.
We still have this problem:

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/accessing_ivars.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   -o /xxx/gnu/gcc-3.0/objdir/gcc/testsuite/accessing_ivars.x    (timeout = 300)
/usr/ccs/bin/ld: Invalid loader fixup for symbol "__objc_class_name_Object".
collect2: ld returned 1 exit status
compiler exited with status 1

The problem is the subspace (section) for __objc_class_name_Object:

__objc_class_name_Object|        32|extern|data   |$CODE$

It's not legit to put data in $CODE$ on the PA.  The symbol is from Object.m.
The other related symbol `__objc_class_name_NXConstantString' is in $LIT$:

__objc_class_name_NXConstantString|         4|extern|data   |$LIT$

Any suggestions on what needs to change to fix this?

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

2001-05-25  John David Anglin  <dave@hiauly1.hia.nrc.ca>

	* ltcf-c.sh (archive_cmd):  Use gcc to link shared archives under hpux
	when $with_gcc = yes.

--- ltcf-c.sh.orig	Sun May 20 14:57:40 2001
+++ ltcf-c.sh	Thu May 24 21:57:52 2001
@@ -411,10 +411,17 @@
     ;;
 
   hpux9* | hpux10* | hpux11*)
-    case $host_os in
-    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
-    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
-    esac
+    if test $with_gcc = yes; then
+      case "$host_os" in
+      hpux9*) archive_cmds='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+      *) archive_cmds='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;;
+      esac
+    else
+      case $host_os in
+      hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
+      *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
+      esac
+    fi
     hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
     hardcode_libdir_separator=:
     hardcode_direct=yes


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]