diff options
author | Allan McRae <allan@archlinux.org> | 2019-01-10 03:47:01 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2019-01-10 05:14:04 +0100 |
commit | 9b2a90cfb1910b5092ffec3375177229101323e4 (patch) | |
tree | 677a31308c45343d17caa23cf92d132902f5a7b8 /m4 | |
parent | 9b637cc27aba561e5270862a1a3eb515e4f3f744 (diff) | |
download | pacman-9b2a90cfb1910b5092ffec3375177229101323e4.tar.gz pacman-9b2a90cfb1910b5092ffec3375177229101323e4.tar.xz |
Add -fstack-clash-protection to CFLAGS in debug builds if available
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'm4')
-rw-r--r-- | m4/acinclude.m4 | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/m4/acinclude.m4 b/m4/acinclude.m4 index 15bb31e8..845c8286 100644 --- a/m4/acinclude.m4 +++ b/m4/acinclude.m4 @@ -38,6 +38,25 @@ AC_DEFUN([GCC_STACK_PROTECT_CC],[ 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 checks -D_FORTIFY_SOURCE with the C compiler, if it exists then updates dnl CPPFLAGS |