Add -fstack-clash-protection to CFLAGS in debug builds if available
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
9b637cc27a
commit
9b2a90cfb1
2 changed files with 20 additions and 0 deletions
|
@ -443,6 +443,7 @@ if test "x$debug" = "xyes" ; then
|
||||||
# Check for -fstack-protector availability
|
# Check for -fstack-protector availability
|
||||||
GCC_STACK_PROTECT_LIB
|
GCC_STACK_PROTECT_LIB
|
||||||
GCC_STACK_PROTECT_CC
|
GCC_STACK_PROTECT_CC
|
||||||
|
GCC_STACK_CLASH_PROTECTION
|
||||||
GCC_FORTIFY_SOURCE_CC
|
GCC_FORTIFY_SOURCE_CC
|
||||||
WARNING_CFLAGS="-g -Wall -Werror"
|
WARNING_CFLAGS="-g -Wall -Werror"
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,6 +38,25 @@ AC_DEFUN([GCC_STACK_PROTECT_CC],[
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl GCC_STACK_CLASH_PROTECTION
|
||||||
|
dnl check -fstack-clash-protection with the C compiler, if it exists then
|
||||||
|
dnl updates CFLAGS
|
||||||
|
AC_DEFUN([GCC_STACK_CLASH_PROTECTION],[
|
||||||
|
AC_LANG_ASSERT(C)
|
||||||
|
if test "X$CC" != "X"; then
|
||||||
|
AC_CACHE_CHECK([whether ${CC} accepts -fstack-clash-protection],
|
||||||
|
scp_cv_cc,
|
||||||
|
[scp_old_cflags="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -fstack-clash-protection"
|
||||||
|
AC_TRY_COMPILE(,, scp_cv_cc=yes, scp_cv_cc=no)
|
||||||
|
CFLAGS="$scp_old_cflags"
|
||||||
|
])
|
||||||
|
if test $scp_cv_cc = yes; then
|
||||||
|
CFLAGS="$CFLAGS -fstack-clash-protection"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
dnl GCC_FORTIFY_SOURCE_CC
|
dnl GCC_FORTIFY_SOURCE_CC
|
||||||
dnl checks -D_FORTIFY_SOURCE with the C compiler, if it exists then updates
|
dnl checks -D_FORTIFY_SOURCE with the C compiler, if it exists then updates
|
||||||
dnl CPPFLAGS
|
dnl CPPFLAGS
|
||||||
|
|
Loading…
Add table
Reference in a new issue