aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-03-12 10:21:21 +0800
committerfanquake <fanquake@gmail.com>2021-03-12 10:21:21 +0800
commit7b3434f8002d1a8cf0dbd0a0caef28e783b1efd8 (patch)
tree90b33dadbe6658a80d5bcf34fd1885dfb79bfbee /configure.ac
parentb972913c330a46811e26221490d3ee042529dfb9 (diff)
downloadbitcoin-7b3434f8002d1a8cf0dbd0a0caef28e783b1efd8.tar.xz
build: don't try and use -fstack-clash-protection on Windows
This has never worked with any of the mingw-w64 compilers we use, and the -O0 is causing issues for builders applying spectre mitigations. Recent discussion on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 also indicates that this should just not be used on Windows.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac15
1 files changed, 10 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 0b176e6039..6815cefdbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -866,11 +866,16 @@ if test x$use_hardening != xno; then
dnl Use CHECK_LINK_FLAG & --fatal-warnings to ensure we won't use the flag in this case.
AX_CHECK_LINK_FLAG([-fcf-protection=full],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fcf-protection=full"],, [[$LDFLAG_WERROR]])
- dnl stack-clash-protection does not work properly when building for Windows.
- dnl We use the test case from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458
- dnl to determine if it can be enabled.
- AX_CHECK_COMPILE_FLAG([-fstack-clash-protection],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-clash-protection"],[],["-O0"],
- [AC_LANG_SOURCE([[class D {public: unsigned char buf[32768];}; int main() {D d; return 0;}]])])
+ case $host in
+ *mingw*)
+ dnl stack-clash-protection doesn't currently work, and likely should just be skipped for Windows.
+ dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 for more details.
+ ;;
+ *)
+ AX_CHECK_COMPILE_FLAG([-fstack-clash-protection],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-clash-protection"])
+ ;;
+ esac
+
dnl When enable_debug is yes, all optimizations are disabled.
dnl However, FORTIFY_SOURCE requires that there is some level of optimization, otherwise it does nothing and just creates a compiler warning.