Introduce a cmake module to figure out whether we need to link with libatomic.

Summary:
This fixes the tests under std/atomics for 32-bit MIPS CPUs where the
8-byte atomic operations call into the libatomic library.

Reviewers: dsanders, mclow.lists, EricWF, jroelofs, joerg

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D16613

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260235 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vasileios Kalintiris
2016-02-09 17:00:38 +00:00
parent 81b46a5bc6
commit b56fdea386
6 changed files with 49 additions and 0 deletions

View File

@@ -15,6 +15,7 @@ pythonize_bool(LIBCXX_ENABLE_SHARED)
pythonize_bool(LIBCXX_BUILD_32_BITS)
pythonize_bool(LIBCXX_GENERATE_COVERAGE)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
# The tests shouldn't link to any ABI library when it has been linked into
# libc++ statically or via a linker script.

View File

@@ -172,6 +172,9 @@ class LinuxLocalTI(DefaultTargetInfo):
flags += ['-lunwind', '-ldl']
else:
flags += ['-lgcc_s', '-lgcc']
use_libatomic = self.full_config.get_lit_bool('use_libatomic', False)
if use_libatomic:
flags += ['-latomic']
san = self.full_config.get_lit_conf('use_sanitizer', '').strip()
if san:
# The libraries and their order are taken from the

View File

@@ -20,6 +20,7 @@ config.generate_coverage = "@LIBCXX_GENERATE_COVERAGE@"
config.target_info = "@LIBCXX_TARGET_INFO@"
config.executor = "@LIBCXX_EXECUTOR@"
config.llvm_unwinder = "@LIBCXXABI_USE_LLVM_UNWINDER@"
config.use_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
# Let the main config do the real work.
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")