Subject: Re: c++ failing on 1.4.3/i386
To: None <martin@duskware.de>
From: Shin'ichiro TAYA <taya@sm.sony.co.jp>
List: tech-toolchain
Date: 10/16/2000 14:27:14
From: Martin Husemann <martin@duskware.de>
Subject: c++ failing on 1.4.3/i386
Date: Mon, 16 Oct 2000 06:41:31 +0200 (MEST)

> Why? How can we fix this?

This is because libgcc linked twice.
Apply this patch instead of patch in pkgsrc to add -nodefaultlibs.
Anyway mozilla does not work on a.out, so I don't known about the
side effect of -nodefaultlibs for mozilla.

diff -ru ../mozilla-current.orig/mozilla/configure.in ./configure.in
--- ../mozilla-current.orig/mozilla/configure.in	Sat Sep 16 07:29:20 2000
+++ ./configure.in	Wed Sep 20 13:26:02 2000
@@ -360,8 +360,6 @@
 TARGET_MD_ARCH=unix
 DIRENT_INO=d_ino
 NEED_BASE_DLL_NAME_ALSO=
-SHLIB_LDSTARTFILE=
-SHLIB_LDENDFILE=
 
 MOZ_JPEG_CFLAGS=
 MOZ_JPEG_LIBS='-L$(DIST)/lib -ljpeg'
@@ -702,31 +700,24 @@
     if $CC -E - -dM </dev/null | grep __ELF__ >/dev/null; then
         DLL_SUFFIX=".so"
         DSO_PIC_CFLAGS='-fPIC -DPIC'
-        DSO_LDOPTS='-x -shared -soname lib$(LIBRARY_NAME)$(DLL_SUFFIX)'
-        SHLIB_LDSTARTFILE=/usr/lib/crtbeginS.o
-        SHLIB_LDENDFILE=/usr/lib/crtendS.o
+        DSO_LDOPTS='-shared -Wl,-soname,lib$(LIBRARY_NAME)$(DLL_SUFFIX)'
     else
     	DSO_PIC_CFLAGS='-fPIC -DPIC'
     	DLL_SUFFIX=".so.1.0"
-    	DSO_LDOPTS='-x -shared'
-    	SHLIB_LDSTARTFILE=/usr/lib/c++rt0.o
+    	DSO_LDOPTS='-shared -nodefaultlibs'
     fi
     # At least for 1.3 and up, ld supports this, despite the test failing above.
-    MKSHLIB_FORCE_ALL='--whole-archive'
-    MKSHLIB_UNFORCE_ALL='--no-whole-archive'
+    MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
+    MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
     case $OS_TEST in
 	alpha)
 		dnl NetBSD/alpha can't find a shared lib
 		dnl (.so.1.0) unless there's a .so as well.
 		NEED_BASE_DLL_NAME_ALSO=1
 		;;
-	*86)
-		MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
-		MKCSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
-		;;
     esac
     if test "$LIBRUNPATH"; then
-	DSO_LDOPTS="-R$LIBRUNPATH $DSO_LDOPTS"
+	DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
     fi
     ;;
 
@@ -978,8 +969,6 @@
 
 dnl See above (netbsd)
 AC_SUBST(NEED_BASE_DLL_NAME_ALSO)
-AC_SUBST(SHLIB_LDSTARTFILE)
-AC_SUBST(SHLIB_LDENDFILE)
 
 dnl Only one oddball right now (QNX), but this gives us flexibility
 dnl if any other platforms need to override this in the future.
@@ -1189,12 +1178,6 @@
     AM_PATH_GTK($GTK_VERSION,,
       AC_MSG_ERROR(Test for GTK failed.))
 
-case "$target" in
-i386-*-netbsd*)
-	GTK_LIBS=`echo $GTK_LIBS | sed -e 's/-Wl,//g'`
-	;;
-esac
-
 dnl ========================================================
 dnl =							   =
 dnl = --with-java-supplement				   =
@@ -1681,13 +1664,6 @@
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-case "$target" in
-i386-*-netbsd*)
-	GLIB_LIBS=`echo $GLIB_LIBS | sed -e 's/-Wl,//g'`
-	LIBIDL_LIBS=`echo $LIBIDL_LIBS | sed -e 's/-Wl,//g'`
-	;;
-esac
-
 dnl Checks for typedefs, structures, and compiler characteristics.
 dnl ========================================================
 AC_C_CONST
@@ -1999,6 +1975,9 @@
 				CXXFLAGS="$CXXFLAGS -mt" 
 			fi
 			;;
+	*-*-netbsd*)
+		USE_PTHREADS=
+		_PTHREAD_LDFLAGS=
 	esac
 	AC_MSG_RESULT($ac_cv_have_dash_pthread)
 fi

---------
And following patch solve a problem with a.out system.
But need more work to run mozilla correctly.
It was two month ago that I tried to run mozilla on 1.4.2. So I forgot
detail, but with these patches I could build mozilla. And after
installation, touch
/usr/X11R6/lib/mozilla/components/libucvlatin.so.1.0(or another DSO.
do not touch other DSO) and run mozilla again as root, then mozilla worked(not
completely). It should be an autoregistration problem.
Maybe it is a hint but after then my interest moved to PSM...

diff -ru ../mozilla-current.orig/mozilla/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h ./xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h
--- ../mozilla-current.orig/mozilla/xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h	Wed Sep 13 04:57:02 2000
+++ ./xpcom/reflect/xptcall/src/md/unix/xptc_platforms_unixish_x86.h	Wed Sep 20 13:27:02 2000
@@ -69,7 +69,11 @@
 #endif
 
 #elif defined(__NetBSD__) 
+#ifdef __ELF__
 #define THUNK_BASED_THIS_ADJUST
+#else
+#define CFRONT_STYLE_THIS_ADJUST
+#endif
 
 #elif defined(__OpenBSD__) 
 /* OpenBSD instroduces GCC 2.95.x in late May 1999 */