aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-08-07 10:57:06 +0200
committerfanquake <fanquake@gmail.com>2023-08-30 16:34:37 +0100
commit96f2cf8d2c3e0fba2a39dabd991dee69124cc79d (patch)
tree9142882ef4e911e61385c61d7234c8f22bacbd74 /configure.ac
parentdf5af114df19730dc1d2936e5819e07273182a76 (diff)
downloadbitcoin-96f2cf8d2c3e0fba2a39dabd991dee69124cc79d.tar.xz
build: use -muse-unaligned-vector-move for Windows
We currently work around a longstanding GCC issue with aligned vector instructions, in our release builds, by patching the behaviour we want into GCC (see discussion in #24736). A new option now exists in the binutils assembler, `-muse-unaligned-vector-move`, which should also achieve the behaviour we want (at least for our code). This was added in the 2.38 release, see https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c8480b58e1968f209b6365af7422678f348222c2. ```bash x86: Add -muse-unaligned-vector-move to assembler Unaligned load/store instructions on aligned memory or register are as fast as aligned load/store instructions on modern Intel processors. Add a command-line option, -muse-unaligned-vector-move, to x86 assembler to encode encode aligned vector load/store instructions as unaligned vector load/store instructions. ``` Even if we introduce this option into our build system, we'll have to maintain our GCC patching, as we want all code that ends up in the binary, to avoid these instructions. However, there may be some value in adding the option, as it could be an improvement for someone building (bitcoind.exe) with an unpatched compiler.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac4
1 files changed, 4 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f0ebc50623..fb154e0b43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -725,6 +725,10 @@ case $host in
dnl We require Windows 7 (NT 6.1) or later
AX_CHECK_LINK_FLAG([-Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1], [CORE_LDFLAGS="$CORE_LDFLAGS -Wl,--major-subsystem-version -Wl,6 -Wl,--minor-subsystem-version -Wl,1"], [], [$LDFLAG_WERROR])
+
+ dnl Avoid the use of aligned vector instructions when building for Windows.
+ dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54412.
+ AX_CHECK_COMPILE_FLAG([-Wa,-muse-unaligned-vector-move], [CORE_CXXFLAGS="$CORE_CXXFLAGS -Wa,-muse-unaligned-vector-move"], [], [$CXXFLAG_WERROR])
;;
*darwin*)
TARGET_OS=darwin