From 763f4bef0d7bec67a90ced2dedbafc9bc46de6de Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 29 Nov 2006 10:54:41 +0000 Subject: 2006-11-29 Thomas Schwinge * 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. --- ChangeLog | 7 +++++++ Makefile.am | 7 +++++++ configure.ac | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd48553..994c6b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-11-29 Thomas Schwinge + + * 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 * 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. # -- cgit v1.2.3