Skip to content

Commit dfc35c9

Browse files
committed
Merge bitcoin#29407: build: remove confusing and inconsistent disable-asm option
f8a06f7 doc: remove references to disable-asm option now that it's gone (Cory Fields) 376f0f6 build: remove confusing and inconsistent disable-asm option (Cory Fields) Pull request description: 1. It didn't actually disable asm usage in our code. Regardless of the setting, asm is used in random.cpp and support/cleanse.cpp. 2. The value wasn't forwarded to libsecp as a user might have reasonably expected. 3. We now have the DISABLE_OPTIMIZED_SHA256 define which is what disable-asm actually did in practice. If there is any desire, we can hook DISABLE_OPTIMIZED_SHA256 up to a new configure option that actually does what it says. Additionally, this is one of the last (THE last?) remaining uses of autoconf defines in our crypto code. As such it seems like low-hanging fruit. ACKs for top commit: fanquake: ACK f8a06f7 Tree-SHA512: 4a99c2130225acbe9dc7399ed572a04ca155cbfa3eef8178a632ba533017d264691e6482cceb1d8f9c5d768619d99a2466dea4b82b27b18b872bceae91b92fbb
2 parents be5399e + f8a06f7 commit dfc35c9

File tree

5 files changed

+4
-36
lines changed

5 files changed

+4
-36
lines changed

configure.ac

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -249,16 +249,6 @@ AC_ARG_ENABLE([threadlocal],
249249
[use_thread_local=$enableval],
250250
[use_thread_local=auto])
251251

252-
AC_ARG_ENABLE([asm],
253-
[AS_HELP_STRING([--disable-asm],
254-
[disable assembly routines (enabled by default)])],
255-
[use_asm=$enableval],
256-
[use_asm=yes])
257-
258-
if test "$use_asm" = "yes"; then
259-
AC_DEFINE([USE_ASM], [1], [Define this symbol to build in assembly routines])
260-
fi
261-
262252
AC_ARG_ENABLE([zmq],
263253
[AS_HELP_STRING([--disable-zmq],
264254
[disable ZMQ notifications])],
@@ -460,8 +450,6 @@ enable_sse41=no
460450
enable_avx2=no
461451
enable_x86_shani=no
462452

463-
if test "$use_asm" = "yes"; then
464-
465453
dnl Check for optional instruction set support. Enabling these does _not_ imply that all code will
466454
dnl be compiled with them, rather that specific objects/libs may use them after checking for runtime
467455
dnl compatibility.
@@ -600,8 +588,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
600588
)
601589
CXXFLAGS="$TEMP_CXXFLAGS"
602590

603-
fi
604-
605591
CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO"
606592

607593
AC_ARG_WITH([utils],
@@ -1817,7 +1803,6 @@ AM_CONDITIONAL([ENABLE_AVX2], [test "$enable_avx2" = "yes"])
18171803
AM_CONDITIONAL([ENABLE_X86_SHANI], [test "$enable_x86_shani" = "yes"])
18181804
AM_CONDITIONAL([ENABLE_ARM_CRC], [test "$enable_arm_crc" = "yes"])
18191805
AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"])
1820-
AM_CONDITIONAL([USE_ASM], [test "$use_asm" = "yes"])
18211806
AM_CONDITIONAL([WORDS_BIGENDIAN], [test "$ac_cv_c_bigendian" = "yes"])
18221807
AM_CONDITIONAL([USE_NATPMP], [test "$use_natpmp" = "yes"])
18231808
AM_CONDITIONAL([USE_UPNP], [test "$use_upnp" = "yes"])
@@ -1972,7 +1957,6 @@ echo " with fuzz binary = $enable_fuzz_binary"
19721957
echo " with bench = $use_bench"
19731958
echo " with upnp = $use_upnp"
19741959
echo " with natpmp = $use_natpmp"
1975-
echo " use asm = $use_asm"
19761960
echo " USDT tracing = $use_usdt"
19771961
echo " sanitizers = $use_sanitizers"
19781962
echo " debug enabled = $enable_debug"

doc/developer-notes.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -577,13 +577,6 @@ export UBSAN_OPTIONS="suppressions=$(pwd)/test/sanitizer_suppressions/ubsan:prin
577577
See the CI config for more examples, and upstream documentation for more information
578578
about any additional options.
579579

580-
There are a number of known problems when using the `address` sanitizer. The
581-
address sanitizer is known to fail in
582-
[sha256_sse4::Transform](/src/crypto/sha256_sse4.cpp) which makes it unusable
583-
unless you also use `--disable-asm` when running configure. We would like to fix
584-
sanitizer issues, so please send pull requests if you can fix any errors found
585-
by the address sanitizer (or any other sanitizer).
586-
587580
Not all sanitizer options can be enabled at the same time, e.g. trying to build
588581
with `--with-sanitizers=address,thread` will fail in the configure script as
589582
these sanitizers are mutually incompatible. Refer to your compiler manual to

doc/fuzzing.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,14 @@ The default Clang/LLVM version supplied by Apple on macOS does not include
127127
fuzzing libraries, so macOS users will need to install a full version, for
128128
example using `brew install llvm`.
129129
130-
Should you run into problems with the address sanitizer, it is possible you
131-
may need to run `./configure` with `--disable-asm` to avoid errors
132-
with certain assembly code from Bitcoin Core's code. See [developer notes on sanitizers](https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#sanitizers)
133-
for more information.
134-
135130
You may also need to take care of giving the correct path for `clang` and
136131
`clang++`, like `CC=/path/to/clang CXX=/path/to/clang++` if the non-systems
137132
`clang` does not come first in your path.
138133
139134
Full configure that was tested on macOS with `brew` installed `llvm`:
140135
141136
```sh
142-
./configure --enable-fuzz --with-sanitizers=fuzzer,address,undefined --disable-asm CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++
137+
./configure --enable-fuzz --with-sanitizers=fuzzer,address,undefined CC=$(brew --prefix llvm)/bin/clang CXX=$(brew --prefix llvm)/bin/clang++
143138
```
144139
145140
Read the [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html) for more information. This [libFuzzer tutorial](https://github.com/google/fuzzing/blob/master/tutorial/libFuzzerTutorial.md) might also be of interest.

src/Makefile.am

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ LIBBITCOIN_WALLET_TOOL=libbitcoin_wallet_tool.a
5050
endif
5151

5252
LIBBITCOIN_CRYPTO = $(LIBBITCOIN_CRYPTO_BASE)
53-
if USE_ASM
5453
LIBBITCOIN_CRYPTO_SSE4 = crypto/libbitcoin_crypto_sse4.la
5554
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE4)
56-
endif
5755
if ENABLE_SSE41
5856
LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.la
5957
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE41)

src/crypto/sha256.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@
2626
#endif
2727

2828
#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
29-
#if defined(USE_ASM)
3029
namespace sha256_sse4
3130
{
3231
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks);
3332
}
3433
#endif
35-
#endif
3634

3735
namespace sha256d64_sse41
3836
{
@@ -574,7 +572,7 @@ bool SelfTest() {
574572
}
575573

576574
#if !defined(DISABLE_OPTIMIZED_SHA256)
577-
#if defined(USE_ASM) && (defined(__x86_64__) || defined(__amd64__) || defined(__i386__))
575+
#if (defined(__x86_64__) || defined(__amd64__) || defined(__i386__))
578576
/** Check whether the OS has enabled AVX registers. */
579577
bool AVXEnabled()
580578
{
@@ -597,7 +595,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem
597595
TransformD64_8way = nullptr;
598596

599597
#if !defined(DISABLE_OPTIMIZED_SHA256)
600-
#if defined(USE_ASM) && defined(HAVE_GETCPUID)
598+
#if defined(HAVE_GETCPUID)
601599
bool have_sse4 = false;
602600
bool have_xsave = false;
603601
bool have_avx = false;
@@ -654,7 +652,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem
654652
ret += ",avx2(8way)";
655653
}
656654
#endif
657-
#endif // defined(USE_ASM) && defined(HAVE_GETCPUID)
655+
#endif // defined(HAVE_GETCPUID)
658656

659657
#if defined(ENABLE_ARM_SHANI)
660658
bool have_arm_shani = false;

0 commit comments

Comments
 (0)