summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Roche <roche@httrack.com>2023-01-13 19:34:50 +0100
committerXavier Roche <roche@httrack.com>2023-01-13 19:39:24 +0100
commit8392245e19416dec51cd7eb8f3896eb99e87c889 (patch)
treed056c2b3d4630bf403f398e0f98c26c5d6762802
parentce3785bb1a1c62d357ec685b5cf9a6af55d8ab50 (diff)
Add support for -fstack-clash-protection
-rwxr-xr-xconfigure35
-rw-r--r--configure.ac1
2 files changed, 36 insertions, 0 deletions
diff --git a/configure b/configure
index 72eb7eb..61915a3 100755
--- a/configure
+++ b/configure
@@ -13664,6 +13664,41 @@ else
:
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstack-clash-protection" >&5
+$as_echo_n "checking whether C compiler accepts -fstack-clash-protection... " >&6; }
+if ${ax_cv_check_cflags___fstack_clash_protection+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ax_check_save_flags=$CFLAGS
+ CFLAGS="$CFLAGS -fstack-clash-protection"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ax_cv_check_cflags___fstack_clash_protection=yes
+else
+ ax_cv_check_cflags___fstack_clash_protection=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ CFLAGS=$ax_check_save_flags
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fstack_clash_protection" >&5
+$as_echo "$ax_cv_check_cflags___fstack_clash_protection" >&6; }
+if test "x$ax_cv_check_cflags___fstack_clash_protection" = xyes; then :
+ DEFAULT_CFLAGS="$DEFAULT_CFLAGS -fstack-clash-protection"
+else
+ :
+fi
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -Wl,--discard-all" >&5
$as_echo_n "checking whether the linker accepts -Wl,--discard-all... " >&6; }
if ${ax_cv_check_ldflags___Wl___discard_all+:} false; then :
diff --git a/configure.ac b/configure.ac
index c92407d..fbed15a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,7 @@ AX_CHECK_COMPILE_FLAG([-Wold-style-definition], [DEFAULT_CFLAGS="$DEFAULT_CFLAGS
AX_CHECK_COMPILE_FLAG([-Wignored-qualifiers], [DEFAULT_CFLAGS="$DEFAULT_CFLAGS -Wignored-qualifiers"])
AX_CHECK_COMPILE_FLAG([-fstrict-aliasing -Wstrict-aliasing], [DEFAULT_CFLAGS="$DEFAULT_CFLAGS -fstrict-aliasing -Wstrict-aliasing"])
AX_CHECK_COMPILE_FLAG([-fstack-protector], [DEFAULT_CFLAGS="$DEFAULT_CFLAGS -fstack-protector"])
+AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [DEFAULT_CFLAGS="$DEFAULT_CFLAGS -fstack-clash-protection"])
AX_CHECK_LINK_FLAG([-Wl,--discard-all], [DEFAULT_LDFLAGS="$DEFAULT_LDFLAGS -Wl,--discard-all"])
AX_CHECK_LINK_FLAG([-Wl,--no-undefined], [DEFAULT_LDFLAGS="$DEFAULT_LDFLAGS -Wl,--no-undefined"])
AX_CHECK_LINK_FLAG([-Wl,-z,relro,-z,now], [DEFAULT_LDFLAGS="$DEFAULT_LDFLAGS -Wl,-z,relro,-z,now"])