summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/cc
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2003-06-13 22:25:41 +0000
committerpeter <peter@FreeBSD.org>2003-06-13 22:25:41 +0000
commitbaa705794e637c095aba62373f694cbe56dc57bd (patch)
treec740315b84d7cde30df306e2b7a8814753a25673 /gnu/usr.bin/cc
parent50a7b0b9b40d5ba0fbc3dd204728fcdb984fe27b (diff)
downloadFreeBSD-src-baa705794e637c095aba62373f694cbe56dc57bd.zip
FreeBSD-src-baa705794e637c095aba62373f694cbe56dc57bd.tar.gz
When building a shared library, link it against libgcc_pic.a instead of the
non-PIC libgcc.a. Linking non-pic code into a shared library is not a good thing. It happens to break amd64 at compile time, and the ppc folks want it too. The problem is mainly with C++ code, unwind-dw2.c in particular. Most of the other functions in libgcc.a are self contained so most of the time it isn't a problem. The dwarf2 unwinder is not safe though since it does make global variable references. Reviewed by: kan
Diffstat (limited to 'gnu/usr.bin/cc')
-rw-r--r--gnu/usr.bin/cc/cc_tools/freebsd-native.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gnu/usr.bin/cc/cc_tools/freebsd-native.h b/gnu/usr.bin/cc/cc_tools/freebsd-native.h
index a102a89..cde8d89 100644
--- a/gnu/usr.bin/cc/cc_tools/freebsd-native.h
+++ b/gnu/usr.bin/cc/cc_tools/freebsd-native.h
@@ -48,7 +48,8 @@
/* For the native system compiler, we actually build libgcc in a profiled
version. So we should use it with -pg. */
-#define LIBGCC_SPEC "%{!pg: -lgcc} %{pg: -lgcc_p}"
+#define LIBGCC_SPEC "%{shared: -lgcc_pic} \
+ %{!shared: %{!pg: -lgcc} %{pg: -lgcc_p}}"
#define LIBSTDCXX_PROFILE "-lstdc++_p"
#define MATH_LIBRARY_PROFILE "-lm_p"
#define FORTRAN_LIBRARY_PROFILE "-lg2c_p"
OpenPOWER on IntegriCloud