0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

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.
This commit is contained in:
Cory Fields 2024-02-07 20:04:01 +00:00
parent 22a5ccfb06
commit 376f0f6d07
3 changed files with 3 additions and 23 deletions

View file

@ -249,16 +249,6 @@ AC_ARG_ENABLE([threadlocal],
[use_thread_local=$enableval], [use_thread_local=$enableval],
[use_thread_local=auto]) [use_thread_local=auto])
AC_ARG_ENABLE([asm],
[AS_HELP_STRING([--disable-asm],
[disable assembly routines (enabled by default)])],
[use_asm=$enableval],
[use_asm=yes])
if test "$use_asm" = "yes"; then
AC_DEFINE([USE_ASM], [1], [Define this symbol to build in assembly routines])
fi
AC_ARG_ENABLE([zmq], AC_ARG_ENABLE([zmq],
[AS_HELP_STRING([--disable-zmq], [AS_HELP_STRING([--disable-zmq],
[disable ZMQ notifications])], [disable ZMQ notifications])],
@ -460,8 +450,6 @@ enable_sse41=no
enable_avx2=no enable_avx2=no
enable_x86_shani=no enable_x86_shani=no
if test "$use_asm" = "yes"; then
dnl Check for optional instruction set support. Enabling these does _not_ imply that all code will dnl Check for optional instruction set support. Enabling these does _not_ imply that all code will
dnl be compiled with them, rather that specific objects/libs may use them after checking for runtime dnl be compiled with them, rather that specific objects/libs may use them after checking for runtime
dnl compatibility. dnl compatibility.
@ -600,8 +588,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
) )
CXXFLAGS="$TEMP_CXXFLAGS" CXXFLAGS="$TEMP_CXXFLAGS"
fi
CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO" CORE_CPPFLAGS="$CORE_CPPFLAGS -DHAVE_BUILD_INFO"
AC_ARG_WITH([utils], AC_ARG_WITH([utils],
@ -1817,7 +1803,6 @@ AM_CONDITIONAL([ENABLE_AVX2], [test "$enable_avx2" = "yes"])
AM_CONDITIONAL([ENABLE_X86_SHANI], [test "$enable_x86_shani" = "yes"]) AM_CONDITIONAL([ENABLE_X86_SHANI], [test "$enable_x86_shani" = "yes"])
AM_CONDITIONAL([ENABLE_ARM_CRC], [test "$enable_arm_crc" = "yes"]) AM_CONDITIONAL([ENABLE_ARM_CRC], [test "$enable_arm_crc" = "yes"])
AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"]) AM_CONDITIONAL([ENABLE_ARM_SHANI], [test "$enable_arm_shani" = "yes"])
AM_CONDITIONAL([USE_ASM], [test "$use_asm" = "yes"])
AM_CONDITIONAL([WORDS_BIGENDIAN], [test "$ac_cv_c_bigendian" = "yes"]) AM_CONDITIONAL([WORDS_BIGENDIAN], [test "$ac_cv_c_bigendian" = "yes"])
AM_CONDITIONAL([USE_NATPMP], [test "$use_natpmp" = "yes"]) AM_CONDITIONAL([USE_NATPMP], [test "$use_natpmp" = "yes"])
AM_CONDITIONAL([USE_UPNP], [test "$use_upnp" = "yes"]) AM_CONDITIONAL([USE_UPNP], [test "$use_upnp" = "yes"])
@ -1972,7 +1957,6 @@ echo " with fuzz binary = $enable_fuzz_binary"
echo " with bench = $use_bench" echo " with bench = $use_bench"
echo " with upnp = $use_upnp" echo " with upnp = $use_upnp"
echo " with natpmp = $use_natpmp" echo " with natpmp = $use_natpmp"
echo " use asm = $use_asm"
echo " USDT tracing = $use_usdt" echo " USDT tracing = $use_usdt"
echo " sanitizers = $use_sanitizers" echo " sanitizers = $use_sanitizers"
echo " debug enabled = $enable_debug" echo " debug enabled = $enable_debug"

View file

@ -50,10 +50,8 @@ LIBBITCOIN_WALLET_TOOL=libbitcoin_wallet_tool.a
endif endif
LIBBITCOIN_CRYPTO = $(LIBBITCOIN_CRYPTO_BASE) LIBBITCOIN_CRYPTO = $(LIBBITCOIN_CRYPTO_BASE)
if USE_ASM
LIBBITCOIN_CRYPTO_SSE4 = crypto/libbitcoin_crypto_sse4.la LIBBITCOIN_CRYPTO_SSE4 = crypto/libbitcoin_crypto_sse4.la
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE4) LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE4)
endif
if ENABLE_SSE41 if ENABLE_SSE41
LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.la LIBBITCOIN_CRYPTO_SSE41 = crypto/libbitcoin_crypto_sse41.la
LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE41) LIBBITCOIN_CRYPTO += $(LIBBITCOIN_CRYPTO_SSE41)

View file

@ -26,13 +26,11 @@
#endif #endif
#if defined(__x86_64__) || defined(__amd64__) || defined(__i386__) #if defined(__x86_64__) || defined(__amd64__) || defined(__i386__)
#if defined(USE_ASM)
namespace sha256_sse4 namespace sha256_sse4
{ {
void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks); void Transform(uint32_t* s, const unsigned char* chunk, size_t blocks);
} }
#endif #endif
#endif
namespace sha256d64_sse41 namespace sha256d64_sse41
{ {
@ -574,7 +572,7 @@ bool SelfTest() {
} }
#if !defined(DISABLE_OPTIMIZED_SHA256) #if !defined(DISABLE_OPTIMIZED_SHA256)
#if defined(USE_ASM) && (defined(__x86_64__) || defined(__amd64__) || defined(__i386__)) #if (defined(__x86_64__) || defined(__amd64__) || defined(__i386__))
/** Check whether the OS has enabled AVX registers. */ /** Check whether the OS has enabled AVX registers. */
bool AVXEnabled() bool AVXEnabled()
{ {
@ -597,7 +595,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem
TransformD64_8way = nullptr; TransformD64_8way = nullptr;
#if !defined(DISABLE_OPTIMIZED_SHA256) #if !defined(DISABLE_OPTIMIZED_SHA256)
#if defined(USE_ASM) && defined(HAVE_GETCPUID) #if defined(HAVE_GETCPUID)
bool have_sse4 = false; bool have_sse4 = false;
bool have_xsave = false; bool have_xsave = false;
bool have_avx = false; bool have_avx = false;
@ -654,7 +652,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem
ret += ",avx2(8way)"; ret += ",avx2(8way)";
} }
#endif #endif
#endif // defined(USE_ASM) && defined(HAVE_GETCPUID) #endif // defined(HAVE_GETCPUID)
#if defined(ENABLE_ARM_SHANI) #if defined(ENABLE_ARM_SHANI)
bool have_arm_shani = false; bool have_arm_shani = false;