--- ceph-17.2.0-359-gb2fe9ec8/cmake/modules/CheckCxxAtomic.cmake.orig 2022-06-03 08:45:32.341075140 -0400 +++ ceph-17.2.0-359-gb2fe9ec8/cmake/modules/CheckCxxAtomic.cmake 2022-06-03 08:46:47.195775813 -0400 @@ -10,8 +10,9 @@ check_cxx_source_compiles(" #include #include +#include -#if defined(__s390x__) || defined(__mips__) +#if defined(__SIZEOF_INT128__) // Boost needs 16-byte atomics for tagged pointers. // These are implemented via inline instructions on the platform // if 16-byte alignment can be proven, and are delegated to libatomic @@ -21,13 +22,27 @@ // We specifically test access via an otherwise unknown pointer here // to ensure we get the most complex case. If this access can be // done without libatomic, then all accesses can be done. -bool atomic16(std::atomic *ptr) +struct tagged_ptr { + int* ptr; + std::size_t tag; +}; + +void atomic16(std::atomic *ptr) __attribute__ ((used)); +void atomic16(std::atomic *ptr) { - return *ptr != 0; + tagged_ptr p{nullptr, 1}; + ptr->store(p); + tagged_ptr f = ptr->load(); + tagged_ptr new_tag{nullptr, 0}; + ptr->compare_exchange_strong(f, new_tag); } #endif int main() { +#if defined(__SIZEOF_INT128__) + std::atomic ptr; + atomic16(&ptr); +#endif std::atomic w1; std::atomic w2; std::atomic w4;