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
This commit is contained in:
Peter Wemm 2003-06-13 22:25:41 +00:00
parent 3d23e8b897
commit a96996a182

View File

@ -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"