[commit: ghc] master: FIX BUILD on OS X 10.5: Check whether ld understands -no_compact_unwind (6067f95)
Ian Lynagh
igloo at earth.li
Thu Oct 20 01:30:32 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/6067f9563d1221b4afec5b52f41e48d4a31e69c2
>---------------------------------------------------------------
commit 6067f9563d1221b4afec5b52f41e48d4a31e69c2
Author: Thorkil Naur <naur at post11.tele.dk>
Date: Wed Oct 19 00:20:53 2011 +0200
FIX BUILD on OS X 10.5: Check whether ld understands -no_compact_unwind
>---------------------------------------------------------------
aclocal.m4 | 25 +++++++++++++++++++++++++
compiler/ghc.mk | 2 ++
compiler/main/DriverPipeline.hs | 3 ++-
configure.ac | 1 +
mk/config.mk.in | 4 ++++
5 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index bbbe7a9..7d0bf86 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -831,6 +831,31 @@ AC_SUBST([LdIsGNULd], [`echo $fp_cv_gnu_ld | sed 'y/yesno/YESNO/'`])
])# FP_PROG_LD_IS_GNU
+# FP_PROG_LD_NO_COMPACT_UNWIND
+# ----------------------------
+
+# Sets the output variable LdHasNoCompactUnwind to YES if ld supports
+# -no_compact_unwind, or NO otherwise.
+AC_DEFUN([FP_PROG_LD_NO_COMPACT_UNWIND],
+[
+AC_CACHE_CHECK([whether ld understands -no_compact_unwind], [fp_cv_ld_no_compact_unwind],
+[echo 'foo() {}' > conftest.c
+${CC-cc} -c conftest.c
+if ${LdCmd} -r -no_compact_unwind -o conftest2.o conftest.o > /dev/null 2>&1; then
+ fp_cv_ld_no_compact_unwind=yes
+else
+ fp_cv_ld_no_compact_unwind=no
+fi
+rm -rf conftest*])
+if test "$fp_cv_ld_no_compact_unwind" = yes; then
+ LdHasNoCompactUnwind=YES
+else
+ LdHasNoCompactUnwind=NO
+fi
+AC_SUBST([LdHasNoCompactUnwind])
+])# FP_PROG_LD_NO_COMPACT_UNWIND
+
+
# FP_PROG_AR
# ----------
# Sets fp_prog_ar_raw to the full path of ar and fp_prog_ar to a non-Cygwin
diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index 54dfa3e..4449a14 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -105,6 +105,8 @@ endif
@echo 'cLeadingUnderscore = "$(LeadingUnderscore)"' >> $@
@echo 'cRAWCPP_FLAGS :: String' >> $@
@echo 'cRAWCPP_FLAGS = "$(RAWCPP_FLAGS)"' >> $@
+ @echo 'cLdHasNoCompactUnwind :: String' >> $@
+ @echo 'cLdHasNoCompactUnwind = "$(LdHasNoCompactUnwind)"' >> $@
@echo 'cLdIsGNULd :: String' >> $@
@echo 'cLdIsGNULd = "$(LdIsGNULd)"' >> $@
@echo 'cLdHasBuildId :: String' >> $@
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 99d3ce7..fd021cc 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1683,7 +1683,8 @@ linkBinary dflags o_files dep_packages = do
-- like
-- ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
-- on x86.
- ++ (if platformOS (targetPlatform dflags) == OSDarwin &&
+ ++ (if cLdHasNoCompactUnwind == "YES" &&
+ platformOS (targetPlatform dflags) == OSDarwin &&
platformArch (targetPlatform dflags) `elem` [ArchX86, ArchX86_64]
then ["-Wl,-no_compact_unwind"]
else [])
diff --git a/configure.ac b/configure.ac
index 5f62083..aec9c88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -702,6 +702,7 @@ dnl ** check for ld, whether it has an -x option, and if it is GNU ld
FP_PROG_LD_X
FP_PROG_LD_IS_GNU
FP_PROG_LD_BUILD_ID
+FP_PROG_LD_NO_COMPACT_UNWIND
FP_VISIBILITY_HIDDEN
diff --git a/mk/config.mk.in b/mk/config.mk.in
index aef0937..03ea2d1 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -693,6 +693,10 @@ LdIsGNULd = @LdIsGNULd@
# disable it with --build-id=none.
LdHasBuildId = @LdHasBuildId@
+# Set to YES if ld has the --no_compact_unwind flag. See #5019
+# and compiler/main/DriverPipeline.hs.
+LdHasNoCompactUnwind = @LdHasNoCompactUnwind@
+
# On MSYS, building with SplitObjs=YES fails with
# ar: Bad file number
# see #3201. We need to specify a smaller max command-line size
More information about the Cvs-ghc
mailing list