summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-11-29 10:54:41 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:56 +0200
commit763f4bef0d7bec67a90ced2dedbafc9bc46de6de (patch)
tree2cc4d968f89b98c7ac567b89560c6a324078466c
parent6c69296d41273d98e59b84000bf93c37c7ff5f03 (diff)
2006-11-29 Thomas Schwinge <tschwinge@gnu.org>
* configure.ac (disable_smashing_stack_protector): New conditional, set depending on the compiler accepting `-fstack-protector' or not. * Makefile.am (CFLAGS): Add `-fno-stack-protector' if `disable_smashing_stack_protector' is set.
-rw-r--r--ChangeLog7
-rw-r--r--Makefile.am7
-rw-r--r--configure.ac24
3 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fd48553..994c6b2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-29 Thomas Schwinge <tschwinge@gnu.org>
+
+ * configure.ac (disable_smashing_stack_protector): New conditional, set
+ depending on the compiler accepting `-fstack-protector' or not.
+ * Makefile.am (CFLAGS): Add `-fno-stack-protector' if
+ `disable_smashing_stack_protector' is set.
+
2006-11-28 Thomas Schwinge <tschwinge@gnu.org>
* doc/Makefrag.am ($(srcdir)/doc/version.texi): Oppress a potential
diff --git a/Makefile.am b/Makefile.am
index 3fc7075..cb07e2f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,6 +58,13 @@ AM_CFLAGS += \
AM_CFLAGS += \
-fno-strict-aliasing
+# The smashing stack protector might be enabled by default, but might emit
+# unsuitable code.
+if disable_smashing_stack_protector
+AM_CFLAGS += \
+ -fno-stack-protector
+endif
+
# For pre Automake 1.10.
AM_CCASFLAGS += \
$(AM_CPPFLAGS)
diff --git a/configure.ac b/configure.ac
index a4866d6..f15f08f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,30 @@ m4_include([linux/configfrag.ac])
dnl [fi]
#
+# Compiler features.
+#
+
+# Smashing stack protector.
+[ssp_possible=yes]
+AC_MSG_CHECKING([whether the compiler accepts `-fstack-protector'])
+# Is this a reliable test case?
+AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
+[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
+# `ac_compile' like this correct, after all?
+if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
+ AC_MSG_RESULT([yes])
+ [# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
+ rm -f conftest.s
+else
+ ssp_possible=no]
+ AC_MSG_RESULT([no])
+[fi
+# Need that, because some distributions ship compilers that include
+# `-fstack-protector' in the default specs.]
+AM_CONDITIONAL([disable_smashing_stack_protector],
+ [[[ x"$ssp_possible" = xyes ]]])
+
+#
# Output.
#