Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Oct 2010 22:18:13 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r214186 - in user/ed/compiler-rt: contrib/llvm/tools/clang/lib/Driver gnu/lib/libgcc gnu/usr.bin/cc/cc_tools lib/libcompiler_rt
Message-ID:  <201010212218.o9LMID6m005673@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Thu Oct 21 22:18:12 2010
New Revision: 214186
URL: http://svn.freebsd.org/changeset/base/214186

Log:
  Just remove libgcc.a and symlink libcompiler_rt.a.
  
  I've noticed GCC tries to be smart when libgcc isn't called libgcc. It
  never tries to link in libgcc_s in that case, causing the unwinder to be
  omitted.
  
  - Revert the changes to Clang and GCC to user -lcompiler_rt.
  - Change libgcc's Makefile to not install libgcc.a and libgcc_p.a.
  - Let libcompiler_rt's Makefile symlink the library.

Modified:
  user/ed/compiler-rt/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
  user/ed/compiler-rt/gnu/lib/libgcc/Makefile
  user/ed/compiler-rt/gnu/usr.bin/cc/cc_tools/freebsd-native.h
  user/ed/compiler-rt/lib/libcompiler_rt/Makefile

Modified: user/ed/compiler-rt/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==============================================================================
--- user/ed/compiler-rt/contrib/llvm/tools/clang/lib/Driver/Tools.cpp	Thu Oct 21 21:08:12 2010	(r214185)
+++ user/ed/compiler-rt/contrib/llvm/tools/clang/lib/Driver/Tools.cpp	Thu Oct 21 22:18:12 2010	(r214186)
@@ -2928,7 +2928,7 @@ void freebsd::Link::ConstructJob(Compila
     }
     // FIXME: For some reason GCC passes -lgcc and -lgcc_s before adding
     // the default system libraries. Just mimic this for now.
-    CmdArgs.push_back("-lcompiler_rt");
+    CmdArgs.push_back("-lgcc");
     if (Args.hasArg(options::OPT_static)) {
       CmdArgs.push_back("-lgcc_eh");
     } else {
@@ -2941,7 +2941,7 @@ void freebsd::Link::ConstructJob(Compila
       CmdArgs.push_back("-lpthread");
     CmdArgs.push_back("-lc");
 
-    CmdArgs.push_back("-lcompiler_rt");
+    CmdArgs.push_back("-lgcc");
     if (Args.hasArg(options::OPT_static)) {
       CmdArgs.push_back("-lgcc_eh");
     } else {

Modified: user/ed/compiler-rt/gnu/lib/libgcc/Makefile
==============================================================================
--- user/ed/compiler-rt/gnu/lib/libgcc/Makefile	Thu Oct 21 21:08:12 2010	(r214185)
+++ user/ed/compiler-rt/gnu/lib/libgcc/Makefile	Thu Oct 21 22:18:12 2010	(r214186)
@@ -3,7 +3,6 @@
 GCCDIR=	${.CURDIR}/../../../contrib/gcc
 GCCLIB=	${.CURDIR}/../../../contrib/gcclibs
 
-LIB=		gcc
 SHLIB_NAME=	libgcc_s.so.1
 SHLIBDIR?=	/lib
 
@@ -334,21 +333,21 @@ CLEANFILES +=	libgcc.map
 #
 # Build additional static libgcc_eh[_p].a libraries.
 #
-lib${LIB}_eh.a:	${EH_OBJS_T}
-	@${ECHO} building static ${LIB}_eh library
+libgcc_eh.a:	${EH_OBJS_T}
+	@${ECHO} building static gcc_eh library
 	@rm -f ${.TARGET}
 	@${AR} cq ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q`
 	${RANLIB} ${.TARGET}
 
-all:	lib${LIB}_eh.a
+all:	libgcc_eh.a
 
 .if ${MK_PROFILE} != "no"
-lib${LIB}_eh_p.a:	${EH_OBJS_P}
-	@${ECHO} building profiled ${LIB}_eh library
+libgcc_eh_p.a:	${EH_OBJS_P}
+	@${ECHO} building profiled gcc_eh library
 	@rm -f ${.TARGET}
 	@${AR} cq ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q`
 	${RANLIB} ${.TARGET}
-all:	lib${LIB}_eh_p.a
+all:	libgcc_eh_p.a
 .endif
 
 _libinstall: _lib-eh-install
@@ -356,14 +355,14 @@ _libinstall: _lib-eh-install
 _lib-eh-install:
 .if ${MK_INSTALLLIB} != "no"
 	${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-		${_INSTALLFLAGS} lib${LIB}_eh.a ${DESTDIR}${LIBDIR}
+		${_INSTALLFLAGS} libgcc_eh.a ${DESTDIR}${LIBDIR}
 .endif
 .if ${MK_PROFILE} != "no"
 	${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-		${_INSTALLFLAGS} lib${LIB}_eh_p.a ${DESTDIR}${LIBDIR}
+		${_INSTALLFLAGS} libgcc_eh_p.a ${DESTDIR}${LIBDIR}
 .endif
 
-CLEANFILES+=	lib${LIB}_eh.a lib${LIB}_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P}
+CLEANFILES+=	libgcc_eh.a libgcc_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P}
 
 .include <bsd.lib.mk>
 

Modified: user/ed/compiler-rt/gnu/usr.bin/cc/cc_tools/freebsd-native.h
==============================================================================
--- user/ed/compiler-rt/gnu/usr.bin/cc/cc_tools/freebsd-native.h	Thu Oct 21 21:08:12 2010	(r214185)
+++ user/ed/compiler-rt/gnu/usr.bin/cc/cc_tools/freebsd-native.h	Thu Oct 21 22:18:12 2010	(r214186)
@@ -48,16 +48,16 @@
 
 #if 0
 #define LIBGCC_SPEC		"%{shared: -lgcc_pic} \
-    %{!shared: %{!pg: -lcompiler_rt} %{pg: -lgcc_p}}"
+    %{!shared: %{!pg: -lgcc} %{pg: -lgcc_p}}"
 #endif
 #define LIBSTDCXX_PROFILE	"-lstdc++_p"
 #define MATH_LIBRARY_PROFILE	"-lm_p"
 #define FORTRAN_LIBRARY_PROFILE	"-lg2c_p"
 
-#define LIBGCC_SPEC		"-lcompiler_rt"
+#define LIBGCC_SPEC		"-lgcc"
 /* For the native system compiler, we actually build libgcc in a profiled
    version.  So we should use it with -pg.  */
-#define LIBGCC_STATIC_LIB_SPEC	  "%{pg: -lgcc_p;:-lcompiler_rt}"
+#define LIBGCC_STATIC_LIB_SPEC	  "%{pg: -lgcc_p;:-lgcc}"
 #define LIBGCC_EH_STATIC_LIB_SPEC "%{pg: -lgcc_eh_p;:-lgcc_eh}"
 
 /* FreeBSD is 4.4BSD derived */

Modified: user/ed/compiler-rt/lib/libcompiler_rt/Makefile
==============================================================================
--- user/ed/compiler-rt/lib/libcompiler_rt/Makefile	Thu Oct 21 21:08:12 2010	(r214185)
+++ user/ed/compiler-rt/lib/libcompiler_rt/Makefile	Thu Oct 21 22:18:12 2010	(r214186)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 LIB=	compiler_rt
 NO_PIC=
 WARNS?=	2
@@ -30,4 +32,11 @@ SRCS+=	absvdi2.c absvsi2.c absvti2.c add
 	udivdi3.c udivmoddi4.c udivmodti4.c udivsi3.c udivti3.c \
 	umoddi3.c umodsi3.c umodti3.c
 
+.if ${MK_INSTALLLIB} != "no"
+SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
+.endif
+.if ${MK_PROFILE} != "no"
+SYMLINKS+=libcompiler_rt_p.a ${LIBDIR}/libgcc_p.a
+.endif
+
 .include <bsd.lib.mk>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010212218.o9LMID6m005673>