Skip to content

Commit 1c3a857

Browse files
committed
Merge #21421: build: don't try and use -fstack-clash-protection on Windows
7b3434f build: don't try and use -fstack-clash-protection on Windows (fanquake) Pull request description: This has never worked with any of the mingw-w64 compilers we use, and the `-O0` is causing issues for builders applying spectre mitigations (see [IRC logs](http://www.erisian.com.au/bitcoin-core-dev/log-2021-03-12.html#l-15)). Recent discussion on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 would also indicate that this should just not be used on Windows. ACKs for top commit: laanwj: Concept and code review ACK (but untested) 7b3434f hebasto: ACK 7b3434f, I've verified that this change does not affect builds for `HOST=x86_64-w64-mingw32` by comparing sizes of the output `*.exe` files. Tree-SHA512: 72b582321ddff8db3201460fa42a53304e70f141ae078d76a4d4eeb1ca27c8dd567ccb468cc8616179c8df784bd8ca038dcb9a277f9e29f9d98c3cc842916b18
2 parents c46f1ce + 7b3434f commit 1c3a857

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

configure.ac

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,11 +866,16 @@ if test x$use_hardening != xno; then
866866
dnl Use CHECK_LINK_FLAG & --fatal-warnings to ensure we won't use the flag in this case.
867867
AX_CHECK_LINK_FLAG([-fcf-protection=full],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fcf-protection=full"],, [[$LDFLAG_WERROR]])
868868

869-
dnl stack-clash-protection does not work properly when building for Windows.
870-
dnl We use the test case from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458
871-
dnl to determine if it can be enabled.
872-
AX_CHECK_COMPILE_FLAG([-fstack-clash-protection],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-clash-protection"],[],["-O0"],
873-
[AC_LANG_SOURCE([[class D {public: unsigned char buf[32768];}; int main() {D d; return 0;}]])])
869+
case $host in
870+
*mingw*)
871+
dnl stack-clash-protection doesn't currently work, and likely should just be skipped for Windows.
872+
dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90458 for more details.
873+
;;
874+
*)
875+
AX_CHECK_COMPILE_FLAG([-fstack-clash-protection],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-clash-protection"])
876+
;;
877+
esac
878+
874879

875880
dnl When enable_debug is yes, all optimizations are disabled.
876881
dnl However, FORTIFY_SOURCE requires that there is some level of optimization, otherwise it does nothing and just creates a compiler warning.

0 commit comments

Comments
 (0)