Standalone scudo uses the atomic operation builtin functions, which require
linking to libatomic on some platforms. Currently, this is done in an ad-hoc
manner. MIPS platforms always link to libatomic, and the tests are always linked
to it as well. libatomic is required on base ARMv6 (but not ARMv6K), but it is
currently not linked, causing the build to fail.
This patch replaces this ad-hoc logic with the CheckAtomic CMake module already
used in other parts of LLVM. The CheckAtomic module checks whether std::atomic
requires libatomic, which is not strictly the same as checking the atomic
builtins, but should have the same results as far as I know. If this is
problematic, a custom version of CheckAtomic could be used to specifically test
the builtins.