Set -fno-stack-protector in CONF_CC_OPTS_STAGE* rathre than extra-gcc-opts
authorIan Lynagh <igloo@earth.li>
Thu, 19 Aug 2010 23:30:31 +0000 (23:30 +0000)
committerIan Lynagh <igloo@earth.li>
Thu, 19 Aug 2010 23:30:31 +0000 (23:30 +0000)
The latter is only used when compiling .hc files, whereas we need it for
.c files too.

aclocal.m4

index e0cae15..a5132f0 100644 (file)
@@ -23,6 +23,15 @@ AC_DEFUN([FPTOOLS_SET_C_LD_FLAGS],
         $3="$$3 -m64"
         ;;
     esac
+
+    # If gcc knows about the stack protector, turn it off.
+    # Otherwise the stack-smash handler gets triggered.
+    echo 'int main(void) {return 0;}' > conftest.c
+    if $CC -c conftest.c -fno-stack-protector > /dev/null 2>&1
+    then
+        $2="$$2 -fno-stack-protector"
+    fi
+    rm conftest.c conftest.o
 ])
 
 
@@ -966,9 +975,6 @@ 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],
@@ -994,12 +1000,6 @@ 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)
 ])