summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac5
-rw-r--r--m4/fp_ld_no_fixup_chains.m424
2 files changed, 29 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 846a4e54e7..6c4b6b6f53 100644
--- a/configure.ac
+++ b/configure.ac
@@ -658,6 +658,11 @@ FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE1],[CONF_GCC_LINKER_OPTS_STAG
FPTOOLS_SET_C_LD_FLAGS([target],[CONF_CC_OPTS_STAGE2],[CONF_GCC_LINKER_OPTS_STAGE2],[CONF_LD_LINKER_OPTS_STAGE2],[CONF_CPP_OPTS_STAGE2])
# Stage 3 won't be supported by cross-compilation
+FP_LD_NO_FIXUP_CHAINS([target], [LDFLAGS])
+FP_LD_NO_FIXUP_CHAINS([build], [CONF_GCC_LINKER_OPTS_STAGE0])
+FP_LD_NO_FIXUP_CHAINS([target], [CONF_GCC_LINKER_OPTS_STAGE1])
+FP_LD_NO_FIXUP_CHAINS([target], [CONF_GCC_LINKER_OPTS_STAGE2])
+
GHC_LLVM_TARGET_SET_VAR
# we intend to pass trough --targets to llvm as is.
LLVMTarget_CPP=` echo "$LlvmTarget"`
diff --git a/m4/fp_ld_no_fixup_chains.m4 b/m4/fp_ld_no_fixup_chains.m4
new file mode 100644
index 0000000000..1d62fd3b20
--- /dev/null
+++ b/m4/fp_ld_no_fixup_chains.m4
@@ -0,0 +1,24 @@
+# FP_LD_NO_FIXUP_CHAINS
+# --------------------
+# See if whether we are using a version of ld64 on darwin platforms which
+# requires us to pass -no_fixup_chains
+#
+# $1 = the platform
+# $2 = the name of the linker flags variable when linking with $CC
+AC_DEFUN([FP_LD_NO_FIXUP_CHAINS], [
+ case $$1 in
+ *-darwin)
+ AC_MSG_CHECKING([whether ld64 requires -no_fixup_chains])
+ echo 'int main(void) {return 0;}' > conftest.c
+ if $CC -o conftest.o -Wl,-no_fixup_chains conftest.c > /dev/null 2>&1
+ then
+ $2="-Wl,-no_fixup_chains"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ rm -f conftest.c conftest.o
+ ;;
+
+ esac
+])