Subject: USE_LIBSTDCXX
To: None <tech-toolchain@netbsd.org>
From: Nick Hudson <skrll@netbsd.org>
List: tech-toolchain
Date: 08/16/2004 09:49:47
--Boundary-00=_rUHIB6P+f3r2mRm
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I noticed that USE_LIBSTDCXX is broken and all the groff tools get linked 
against stdc++.

Is the attached fix OK?

Nick





--Boundary-00=_rUHIB6P+f3r2mRm
Content-Type: text/x-diff;
  charset="us-ascii";
  name="USE_LIBSTDCXX.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="USE_LIBSTDCXX.diff"

Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.prog.mk,v
retrieving revision 1.202
diff -u -r1.202 bsd.prog.mk
--- share/mk/bsd.prog.mk	4 Aug 2004 05:32:47 -0000	1.202
+++ share/mk/bsd.prog.mk	16 Aug 2004 08:44:24 -0000
@@ -142,9 +142,11 @@
 .if defined(PROG_CXX)
 _CCLINK=	${CXX}
 .if ${USE_LIBSTDCXX} == "no"
-_SUPCXX=	-lsupc++ -lm
+_SUPCXX=	-lsupc++
+_SUPCXXOPTS=	-static-libgcc
 .else
-_SUPCXX=	-lstdc++ -lm
+_SUPCXX=	# -lstdc++ automatically added by g++ when linking
+_SUPCXXOPTS=	
 .endif
 .else
 _CCLINK=	${CC}
@@ -167,10 +169,10 @@
 .if !commands(${PROG})
 	${_MKTARGET_LINK}
 .if defined(DESTDIR)
-	${_CCLINK} -Wl,-nostdlib \
+	${_CCLINK} -Wl,-nostdlib ${_SUPCXXOPTS} \
 	    ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} \
 	    -B${_GCC_CRTDIR}/ -B${DESTDIR}/usr/lib/  \
-	    ${OBJS} ${LDADD} \
+	    ${OBJS} ${LDADD} ${_SUPCXX} \
 	    -L${_GCC_LIBGCCDIR} -L${DESTDIR}/usr/lib
 .else
 	${_CCLINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${_PROGLDOPTS} ${OBJS} ${LDADD}
Index: gnu/dist/gcc/gcc/cp/g++spec.c
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/gcc/cp/g++spec.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 g++spec.c
--- gnu/dist/gcc/gcc/cp/g++spec.c	23 Jul 2003 02:41:09 -0000	1.1.1.1
+++ gnu/dist/gcc/gcc/cp/g++spec.c	16 Aug 2004 08:44:25 -0000
@@ -42,6 +42,9 @@
 #ifndef LIBSTDCXX_PROFILE
 #define LIBSTDCXX_PROFILE "-lstdc++"
 #endif
+#ifndef LIBSUPCXX
+#define LIBSUPCXX "-lsupc++"
+#endif
 
 void
 lang_specific_driver (in_argc, in_argv, in_added_libraries)
@@ -129,7 +132,8 @@
       if (argv[i][0] == '-')
 	{
 	  if (library != 0 && (strcmp (argv[i], "-nostdlib") == 0
-			       || strcmp (argv[i], "-nodefaultlibs") == 0))
+			       || strcmp (argv[i], "-nodefaultlibs") == 0
+			       || strcmp (argv[i], LIBSUPCXX) == 0))
 	    {
 	      library = 0;
 	    }

--Boundary-00=_rUHIB6P+f3r2mRm--