summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aclocal.m49
-rw-r--r--rts/ghc.mk5
2 files changed, 9 insertions, 5 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 53bd165bec..5358cc2727 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -962,6 +962,9 @@ AC_SUBST([GhcPkgCmd])
# reordering things in the module and confusing the manger and/or splitter.
# (eg. Trac #1427)
#
+# If gcc knows about the stack protector, turn it off.
+# Otherwise the stack-smash handler gets triggered.
+#
AC_DEFUN([FP_GCC_EXTRA_FLAGS],
[AC_REQUIRE([FP_HAVE_GCC])
AC_CACHE_CHECK([for extra options to pass gcc when compiling via C], [fp_cv_gcc_extra_opts],
@@ -987,6 +990,12 @@ AC_CACHE_CHECK([for extra options to pass gcc when compiling via C], [fp_cv_gcc_
[])
;;
esac
+ echo 'int main(void) {return 0;}' > conftest.c
+ if $CC -c conftest.c -fno-stack-protector > /dev/null 2>&1
+ then
+ fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-stack-protector"
+ fi
+ rm conftest.c conftest.o
])
AC_SUBST([GccExtraViaCOpts],$fp_cv_gcc_extra_opts)
])
diff --git a/rts/ghc.mk b/rts/ghc.mk
index 8b6ecb1ce8..ca68b55a17 100644
--- a/rts/ghc.mk
+++ b/rts/ghc.mk
@@ -252,11 +252,6 @@ rts_CC_OPTS += $(MACOSX_DEPLOYMENT_CC_OPTS)
rts_HC_OPTS += $(addprefix -optc, $(MACOSX_DEPLOYMENT_CC_OPTS))
rts_LD_OPTS += $(addprefix -optl, $(MACOSX_DEPLOYMENT_LD_OPTS))
-# Otherwise the stack-smash handler gets triggered.
-ifneq "$(findstring $(TargetOS_CPP), darwin openbsd)" ""
-rts_HC_OPTS += -optc-fno-stack-protector
-endif
-
# We *want* type-checking of hand-written cmm.
rts_HC_OPTS += -dcmm-lint