diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -3,7 +3,7 @@ enable_cache: true distro: "debian" suites: -- "buster" +- "bullseye" architectures: - "amd64" packages: @@ -13,25 +13,25 @@ - "binutils-arm-linux-gnueabihf" - "binutils-gold" - "bsdmainutils" -- "build-essential" - "ca-certificates" +- "cmake" - "curl" - "faketime" -- "g++-aarch64-linux-gnu" -- "g++-arm-linux-gnueabihf" -- "gcc-aarch64-linux-gnu" -- "gcc-arm-linux-gnueabihf" +# Use gcc/g++ 9 to avoid introducing the new pthread_cond_clockwait from glibc +# 2.30, which would make our release binary incompatible with systems using an +# older glibc version. +- "g++-9" +- "g++-9-aarch64-linux-gnu" +- "g++-9-arm-linux-gnueabihf" +- "gcc-9" +- "gcc-9-aarch64-linux-gnu" +- "gcc-9-arm-linux-gnueabihf" - "git" - "gperf" - "libtool" - "ninja-build" - "pkg-config" - "python3" -repositories: -- "distribution": "buster-backports" - "source": "deb http://deb.debian.org/debian/ buster-backports main" - packages: - - "cmake" remotes: - "url": "https://github.com/Bitcoin-ABC/bitcoin-abc.git" "dir": "bitcoin" @@ -97,10 +97,38 @@ done } + function create_per-host_compiler_wrapper { + for i in ${HOSTS[@]}; do + for prog in gcc g++; do + echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${i}-${prog} + echo "REAL=\`which -a ${i}-${prog}-9 | head -1\`" >> ${WRAP_DIR}/${i}-${prog} + echo "\$REAL \"\$@\"" >> $WRAP_DIR/${i}-${prog} + chmod +x ${WRAP_DIR}/${i}-${prog} + done + done + } + + function create_native_compiler_wrapper { + for prog in gcc g++; do + echo '#!/usr/bin/env bash' > ${WRAP_DIR}/${prog} + echo "REAL=\`which -a x86_64-linux-gnu-${prog}-9 | head -1\`" >> ${WRAP_DIR}/${prog} + echo "\$REAL \"\$@\"" >> $WRAP_DIR/${prog} + chmod +x ${WRAP_DIR}/${prog} + done + } + # Faketime for depends so intermediate results are comparable export PATH_orig=${PATH} create_global_faketime_wrappers "2000-01-01 12:00:00" create_per-host_faketime_wrappers "2000-01-01 12:00:00" + + # Wrap the compiler -gcc-9 and -g++-9 into -gcc and + # -g++ + create_per-host_compiler_wrapper + # For the current host platform also wrap into regular gcc and g++, assume + # x86_64 + create_native_compiler_wrapper + export PATH=${WRAP_DIR}:${PATH} cd bitcoin diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml --- a/contrib/gitian-descriptors/gitian-osx.yml +++ b/contrib/gitian-descriptors/gitian-osx.yml @@ -3,7 +3,7 @@ enable_cache: true distro: "debian" suites: -- "buster" +- "bullseye" architectures: - "amd64" packages: @@ -11,6 +11,7 @@ - "automake" - "bsdmainutils" - "ca-certificates" +- "cmake" - "curl" - "faketime" - "fonts-tuffy" @@ -29,11 +30,6 @@ - "python3" - "python3-dev" - "python3-setuptools" -repositories: -- "distribution": "buster-backports" - "source": "deb http://deb.debian.org/debian/ buster-backports main" - packages: - - "cmake" remotes: - "url": "https://github.com/Bitcoin-ABC/bitcoin-abc.git" "dir": "bitcoin" diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -3,7 +3,7 @@ enable_cache: true distro: "debian" suites: -- "buster" +- "bullseye" architectures: - "amd64" packages: @@ -11,6 +11,7 @@ - "automake" - "bsdmainutils" - "ca-certificates" +- "cmake" - "curl" - "faketime" - "g++" @@ -23,11 +24,6 @@ - "pkg-config" - "python3" - "zip" -repositories: -- "distribution": "buster-backports" - "source": "deb http://deb.debian.org/debian/ buster-backports main" - packages: - - "cmake" remotes: - "url": "https://github.com/Bitcoin-ABC/bitcoin-abc.git" "dir": "bitcoin" diff --git a/contrib/teamcity/gitian.sh b/contrib/teamcity/gitian.sh --- a/contrib/teamcity/gitian.sh +++ b/contrib/teamcity/gitian.sh @@ -14,7 +14,7 @@ cd "${TOPLEVEL}/contrib/gitian-builder" -./bin/make-base-vm --docker --arch amd64 --distro debian --suite buster +./bin/make-base-vm --docker --arch amd64 --distro debian --suite bullseye if [[ "${OS_NAME}" == "osx" ]]; then OSX_SDK_DIR=~/.abc-build-cache/osx-sdk diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -276,6 +276,9 @@ # Wrap some glibc functions with ours add_linker_flags(-Wl,--wrap=__divmoddi4) add_linker_flags(-Wl,--wrap=log2f) + add_linker_flags(-Wl,--wrap=exp) + add_linker_flags(-Wl,--wrap=log) + add_linker_flags(-Wl,--wrap=pow) if(NOT HAVE_LARGE_FILE_SUPPORT) add_linker_flags(-Wl,--wrap=fcntl -Wl,--wrap=fcntl64) diff --git a/src/compat/glibc_compat.cpp b/src/compat/glibc_compat.cpp --- a/src/compat/glibc_compat.cpp +++ b/src/compat/glibc_compat.cpp @@ -93,3 +93,49 @@ return ret; } #endif + +/** + * Starting with GLIBC_2.29 there is an optimized version of the math functions. + * See https://lwn.net/Articles/778286/ + */ +extern "C" float exp_old(float x); +#ifdef __i386__ +__asm(".symver exp_old,exp@GLIBC_2.1"); +#elif defined(__amd64__) +__asm(".symver exp_old,exp@GLIBC_2.2.5"); +#elif defined(__arm__) +__asm(".symver exp_old,exp@GLIBC_2.4"); +#elif defined(__aarch64__) +__asm(".symver exp_old,exp@GLIBC_2.17"); +#endif +extern "C" float __wrap_exp(float x) { + return exp_old(x); +} + +extern "C" float log_old(float x); +#ifdef __i386__ +__asm(".symver log_old,log@GLIBC_2.1"); +#elif defined(__amd64__) +__asm(".symver log_old,log@GLIBC_2.2.5"); +#elif defined(__arm__) +__asm(".symver log_old,log@GLIBC_2.4"); +#elif defined(__aarch64__) +__asm(".symver log_old,log@GLIBC_2.17"); +#endif +extern "C" float __wrap_log(float x) { + return log_old(x); +} + +extern "C" float pow_old(float x); +#ifdef __i386__ +__asm(".symver pow_old,pow@GLIBC_2.1"); +#elif defined(__amd64__) +__asm(".symver pow_old,pow@GLIBC_2.2.5"); +#elif defined(__arm__) +__asm(".symver pow_old,pow@GLIBC_2.4"); +#elif defined(__aarch64__) +__asm(".symver pow_old,pow@GLIBC_2.17"); +#endif +extern "C" float __wrap_pow(float x) { + return pow_old(x); +}