Skip to content

Commit 376f0f6

Browse files
committed
build: remove confusing and inconsistent disable-asm option
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.
1 parent 22a5ccf commit 376f0f6

File tree

3 files changed

+3
-23
lines changed

3 files changed

+3
-23
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"

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)