mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
51bc8bdcd6
dd3e0fa12534c9e782dc9c24d2e30b70a0d73176 build: Fix false positive `CHECK_ATOMIC` test for clang-15 (Hennadii Stepanov) Pull request description: On the master branch @ 0de63b8b46eff5cda85b4950062703324ba65a80, a building `bitcoind` with clang-15 for `i686-pc-linux-gnu` fails to link: ``` CXXLD bitcoind /usr/bin/ld: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): in function `std::remove_volatile<double>::type std::__atomic_impl::load<double>(double const*, std::memory_order)': /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:948: undefined reference to `__atomic_load' /usr/bin/ld: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): in function `void std::__atomic_impl::store<double>(double*, std::remove_volatile<double>::type, std::memory_order)': /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): in function `void std::__atomic_impl::store<double>(double*, std::remove_volatile<double>::type, std::memory_order)': /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): in function `std::remove_volatile<double>::type std::__atomic_impl::load<double>(double const*, std::memory_order)': /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:948: undefined reference to `__atomic_load' /usr/bin/ld: libbitcoin_wallet.a(libbitcoin_wallet_a-wallet.o): in function `void std::__atomic_impl::store<double>(double*, std::remove_volatile<double>::type, std::memory_order)': /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: libbitcoin_wallet.a(libbitcoin_wallet_a-backup.o): in function `void std::__atomic_impl::store<double>(double*, std::remove_volatile<double>::type, std::memory_order)': /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: undefined reference to `__atomic_store' /usr/bin/ld: libbitcoin_wallet.a(libbitcoin_wallet_a-backup.o):/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/atomic_base.h:940: more undefined references to `__atomic_store' follow clang: error: linker command failed with exit code 1 (use -v to see invocation) ``` due to false positive `CHECK_ATOMIC` test in the `configure` script. This PR fixes this test. ACKs for top commit: maflcko: review ACK dd3e0fa12534c9e782dc9c24d2e30b70a0d73176 fanquake: ACK dd3e0fa12534c9e782dc9c24d2e30b70a0d73176 Tree-SHA512: b60acf8d83fc84cc3280d95028395d341ed9ed2fcf38ae0a101d50aa19cc35540e9763aa36668c4dc1e1bc7e1f33dbda0e662df39c9e414a284ef91d7fc55fba
66 lines
1.7 KiB
Plaintext
66 lines
1.7 KiB
Plaintext
dnl Copyright (c) 2015 Tim Kosse <tim.kosse@filezilla-project.org>
|
|
dnl Copying and distribution of this file, with or without modification, are
|
|
dnl permitted in any medium without royalty provided the copyright notice
|
|
dnl and this notice are preserved. This file is offered as-is, without any
|
|
dnl warranty.
|
|
|
|
# Clang, when building for 32-bit,
|
|
# and linking against libstdc++, requires linking with
|
|
# -latomic if using the C++ atomic library.
|
|
# Can be tested with: clang++ -std=c++20 test.cpp -m32
|
|
#
|
|
# Sourced from http://bugs.debian.org/797228
|
|
|
|
m4_define([_CHECK_ATOMIC_testbody], [[
|
|
#include <atomic>
|
|
#include <cstdint>
|
|
#include <chrono>
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
int main() {
|
|
std::atomic<bool> lock{true};
|
|
lock.exchange(false);
|
|
|
|
std::atomic<std::chrono::seconds> t{0s};
|
|
t.store(2s);
|
|
auto t1 = t.load();
|
|
t.compare_exchange_strong(t1, 3s);
|
|
|
|
std::atomic<double> d{};
|
|
d.store(3.14);
|
|
auto d1 = d.load();
|
|
|
|
std::atomic<int64_t> a{};
|
|
int64_t v = 5;
|
|
int64_t r = a.fetch_add(v);
|
|
return static_cast<int>(r);
|
|
}
|
|
]])
|
|
|
|
AC_DEFUN([CHECK_ATOMIC], [
|
|
|
|
AC_LANG_PUSH(C++)
|
|
TEMP_CXXFLAGS="$CXXFLAGS"
|
|
CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
|
|
|
|
AC_MSG_CHECKING([whether std::atomic can be used without link library])
|
|
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_ATOMIC_testbody])],[
|
|
AC_MSG_RESULT([yes])
|
|
],[
|
|
AC_MSG_RESULT([no])
|
|
LIBS="$LIBS -latomic"
|
|
AC_MSG_CHECKING([whether std::atomic needs -latomic])
|
|
AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_ATOMIC_testbody])],[
|
|
AC_MSG_RESULT([yes])
|
|
],[
|
|
AC_MSG_RESULT([no])
|
|
AC_MSG_FAILURE([cannot figure out how to use std::atomic])
|
|
])
|
|
])
|
|
|
|
CXXFLAGS="$TEMP_CXXFLAGS"
|
|
AC_LANG_POP
|
|
])
|