From bf83cab6cf0dd456d9155a43e6a40a1a201a817a Mon Sep 17 00:00:00 2001 From: "James C. Owens" Date: Sat, 6 Nov 2021 11:26:08 -0400 Subject: [PATCH] Disable -fcf-protection for mingw win32 -fcf-protection does not appear to work properly for mingw in i686 and results in unstable executables being compiled. This disables -fcf-protection for i686-w64-mingw32 hosts only. --- configure.ac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index fc5e47bd08..117870d8b4 100755 --- a/configure.ac +++ b/configure.ac @@ -645,7 +645,15 @@ if test x$use_hardening != xno; then AX_CHECK_COMPILE_FLAG([-Wstack-protector],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"]) AX_CHECK_COMPILE_FLAG([-fstack-protector-all],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-protector-all"]) - AX_CHECK_COMPILE_FLAG([-fcf-protection=full],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fcf-protection=full"]) + case $host in + i686-w64-mingw32) + dnl Control-Flow Enforcement Technology (CET) does not appear to work for mingw for i686 (32-bit) + dnl When it is enabled, unstable executables result. Disable for now. + ;; + *) + AX_CHECK_COMPILE_FLAG([-fcf-protection=full],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fcf-protection=full"]) + ;; + esac case $host in *mingw*)