summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2022-10-27 18:33:41 -0600
committerTodd C. Miller <Todd.Miller@sudo.ws>2022-10-27 18:33:41 -0600
commitf3094fe3487e6d4aab53f4303d0d214a2db9c392 (patch)
treec4c6e2627e7140ca64d676a9efb1df7ae72e457c /configure.ac
parent329b5923939b5af311182957cf6ea4d65989f3b3 (diff)
downloadsudo-f3094fe3487e6d4aab53f4303d0d214a2db9c392.tar.gz
Check that compiler accepts -fstack-clash-protection and -fcf-protection.
Previously, we only checked that linker accepted them. GitHub issue #191
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 10 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 103bc4fad..6acdcc62e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4956,13 +4956,17 @@ if test "$enable_hardening" != "no" && test "$enable_ssp" != "no"; then
fi
fi
if test "$enable_hardening" != "no"; then
- AX_CHECK_LINK_FLAG([-fstack-clash-protection], [
- AX_APPEND_FLAG([-fstack-clash-protection], [HARDENING_CFLAGS])
- AX_APPEND_FLAG([-Wc,-fstack-clash-protection], [HARDENING_LDFLAGS])
+ AX_CHECK_COMPILE_FLAG([-fstack-clash-protection], [
+ AX_CHECK_LINK_FLAG([-fstack-clash-protection], [
+ AX_APPEND_FLAG([-fstack-clash-protection], [HARDENING_CFLAGS])
+ AX_APPEND_FLAG([-Wc,-fstack-clash-protection], [HARDENING_LDFLAGS])
+ ])
])
- AX_CHECK_LINK_FLAG([-fcf-protection], [
- AX_APPEND_FLAG([-fcf-protection], [HARDENING_CFLAGS])
- AX_APPEND_FLAG([-Wc,-fcf-protection], [HARDENING_LDFLAGS])
+ AX_CHECK_COMPILE_FLAG([-fcf-protection], [
+ AX_CHECK_LINK_FLAG([-fcf-protection], [
+ AX_APPEND_FLAG([-fcf-protection], [HARDENING_CFLAGS])
+ AX_APPEND_FLAG([-Wc,-fcf-protection], [HARDENING_LDFLAGS])
+ ])
])
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [AX_APPEND_FLAG([-Wl,-z,relro], [LDFLAGS])])
AX_CHECK_LINK_FLAG([-Wl,-z,now], [AX_APPEND_FLAG([-Wl,-z,now], [LDFLAGS])])