This is the mail archive of the gcc-patches@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]

libtool upgrade broke libstdc++-v3 on Solaris


The libtool upgrade also backed out a patch by Mark Mitchell that
arranged for libtool to use gcc instead of ld to link C code.  Why
does this affect libstdc++-v3?  Because libstdc++-v3 used to be linked
pretending it was C, because using g++ would attempt to link libstdc++
in, which obviously wouldn't work.

Instead of re-installing Mark Mitchell's patch, I decided the whole
approach of pretending libstdc++-v3 was C was wrong, and deemed to
break on other platforms.

The fix I chose was to get libstdc++ configured to use xgcc instead of
g++ as the C++ compiler driver, so as to not link libstdc++ in, and
then adjust libstdc++'s work-arounds so as to use CXX to link a C++
library.  This was tested on sparc-sun-solaris2.7, GCC 3.0 branch.
I'm checking this in the branch and in the trunk.

Index: ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* configure.in (CXX_FOR_TARGET): Use xgcc for libstdc++-v3.

Index: libstdc++-v3/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* libsupc++/Makefile.am (CXXLINK): Use CXX again, and choose
	CXX tag explicitly.
	* src/Makefile.am (CXXLINK): Likewise.
	* libsupc++/Makefile.in, src/Makefile.in: Rebuilt.

Index: configure.in
===================================================================
RCS file: /cvs/gcc/egcs/configure.in,v
retrieving revision 1.90.2.4
diff -u -p -r1.90.2.4 configure.in
--- configure.in 2001/03/10 00:18:10 1.90.2.4
+++ configure.in 2001/03/27 21:46:08
@@ -1456,7 +1456,7 @@ fi
 if test "x${CXX_FOR_TARGET+set}" = xset; then
   :
 elif test -d ${topsrcdir}/gcc; then
-  CXX_FOR_TARGET='$$r/gcc/g++ -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
+  CXX_FOR_TARGET='$$r/gcc/`case $$dir in libstdc++-v3) echo xgcc ;; *) echo g++ ;; esac` -B$$r/gcc/ -nostdinc++ '$libstdcxx_flags
 elif test "$host" = "$target"; then
   CXX_FOR_TARGET='$(CXX)'
 else
Index: libstdc++-v3/libsupc++/Makefile.am
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/libsupc++/Makefile.am,v
retrieving revision 1.19.2.1
diff -u -p -r1.19.2.1 Makefile.am
--- libstdc++-v3/libsupc++/Makefile.am 2001/02/17 18:13:08 1.19.2.1
+++ libstdc++-v3/libsupc++/Makefile.am 2001/03/27 21:46:08
@@ -133,11 +133,13 @@ LTCXXCOMPILE = $(LIBTOOL) --tag CXX --ta
                --mode=compile $(CXX) $(INCLUDES) \
 	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
 
-# 3) We have a problem when building the shared libstdc++ object if
-# the rules automake generates would be used.  We cannot allow CXX to
-# be used in libtool since this would add -lstdc++ to the link line
-# which of course is problematic at this point.
-CXXLINK = $(LIBTOOL) --mode=link "$(CC)" \
+# 3) We'd have a problem when building the shared libstdc++ object if
+# the rules automake generates would be used.  We cannot allow g++ to
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point.  So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
 	  @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
 
 
Index: libstdc++-v3/src/Makefile.am
===================================================================
RCS file: /cvs/gcc/egcs/libstdc++-v3/src/Makefile.am,v
retrieving revision 1.71.2.3
diff -u -p -r1.71.2.3 Makefile.am
--- libstdc++-v3/src/Makefile.am 2001/02/28 06:45:36 1.71.2.3
+++ libstdc++-v3/src/Makefile.am 2001/03/27 21:46:10
@@ -343,9 +343,11 @@ AM_CXXFLAGS = \
 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
 	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
 
-# 3) We have a problem when building the shared libstdc++ object if
-# the rules automake generates would be used.  We cannot allow CXX to
-# be used in libtool since this would add -lstdc++ to the link line
-# which of course is problematic at this point.
-CXXLINK = $(LIBTOOL) --mode=link "$(CC)" \
+# 3) We'd have a problem when building the shared libstdc++ object if
+# the rules automake generates would be used.  We cannot allow g++ to
+# be used since this would add -lstdc++ to the link line which of
+# course is problematic at this point.  So, we get the top-level
+# directory to configure libstdc++-v3 to use gcc as the C++
+# compilation driver.
+CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
 	  @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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