Better detect 64bit atomics support. It appears that on i586 std::atomic::load is compiled into instruction, but std::atomic::load uses __atomic_load_8. This must be detected so the build system links it to libatomic. Index: llvm-12.0.0.src/cmake/modules/CheckAtomic.cmake =================================================================== --- llvm-12.0.0.src.orig/cmake/modules/CheckAtomic.cmake +++ llvm-12.0.0.src/cmake/modules/CheckAtomic.cmake @@ -30,9 +30,12 @@ function(check_working_cxx_atomics64 var #include #include std::atomic x (0); +std::atomic y (0); int main() { uint64_t i = x.load(std::memory_order_relaxed); + double j = y.load(std::memory_order_relaxed); (void)i; + (void)j; return 0; } " ${varname})