aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2016-07-18 06:01:50 +0000
committerEric Fiselier <eric@efcs.ca>2016-07-18 06:01:50 +0000
commita23470efe73675cedb71693d9253e50a39dcb914 (patch)
treeb6a71bf5fc8b643db17f985ac62e20214f83808e /libcxx
parent733f795947646ab20196863af40a67226a22242f (diff)
downloadllvm-a23470efe73675cedb71693d9253e50a39dcb914.zip
llvm-a23470efe73675cedb71693d9253e50a39dcb914.tar.gz
llvm-a23470efe73675cedb71693d9253e50a39dcb914.tar.bz2
Rework libatomic handling in CMake and LIT.
This patch updates the way libc++ handles checking for libatomic, in part to prepare for https://reviews.llvm.org/D22073. Changes: * 'LIBCXX_HAS_ATOMIC_LIB' is now set whenever libatomic is available even libc++ doesn't need to manually link it. * 'LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB' is now used to detect when libatomic needs to be manually linked. * 'LIBCXX_HAS_ATOMIC_LIB' now adds 'libatomic' as a available feature in the test suite. llvm-svn: 275759
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/cmake/Modules/CheckLibcxxAtomic.cmake2
-rw-r--r--libcxx/lib/CMakeLists.txt2
-rw-r--r--libcxx/test/CMakeLists.txt1
-rw-r--r--libcxx/test/libcxx/test/config.py3
-rw-r--r--libcxx/test/lit.site.cfg.in4
5 files changed, 9 insertions, 3 deletions
diff --git a/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake b/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake
index ca490b3..4ff3432 100644
--- a/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake
+++ b/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake
@@ -26,9 +26,9 @@ int main() {
endfunction(check_cxx_atomics)
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
+check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
# If not, check if the library exists, and atomics work with it.
if(NOT LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB)
- check_library_exists(atomic __atomic_fetch_add_8 "" LIBCXX_HAS_ATOMIC_LIB)
if(LIBCXX_HAS_ATOMIC_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
check_cxx_atomics(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
diff --git a/libcxx/lib/CMakeLists.txt b/libcxx/lib/CMakeLists.txt
index 3cfc367..afc388e 100644
--- a/libcxx/lib/CMakeLists.txt
+++ b/libcxx/lib/CMakeLists.txt
@@ -79,7 +79,7 @@ add_library_flags_if(LIBCXX_HAS_C_LIB c)
add_library_flags_if(LIBCXX_HAS_M_LIB m)
add_library_flags_if(LIBCXX_HAS_RT_LIB rt)
add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s)
-add_library_flags_if(LIBCXX_HAS_ATOMIC_LIB atomic)
+add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic)
# Setup flags.
add_flags_if_supported(-fPIC)
diff --git a/libcxx/test/CMakeLists.txt b/libcxx/test/CMakeLists.txt
index 1d99837..d47a9e0 100644
--- a/libcxx/test/CMakeLists.txt
+++ b/libcxx/test/CMakeLists.txt
@@ -19,6 +19,7 @@ pythonize_bool(LIBCXX_GENERATE_COVERAGE)
pythonize_bool(LIBCXXABI_ENABLE_SHARED)
pythonize_bool(LIBCXXABI_USE_LLVM_UNWINDER)
pythonize_bool(LIBCXX_HAS_ATOMIC_LIB)
+pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB)
# The tests shouldn't link to any ABI library when it has been linked into
# libc++ statically or via a linker script.
diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py
index 9050458..593f980 100644
--- a/libcxx/test/libcxx/test/config.py
+++ b/libcxx/test/libcxx/test/config.py
@@ -290,6 +290,9 @@ class Configuration(object):
if self.cxx.hasCompileFlag('-fsized-deallocation'):
self.config.available_features.add('fsized-deallocation')
+ if self.get_lit_bool('has_libatomic', False):
+ self.config.available_features.add('libatomic')
+
def configure_compile_flags(self):
no_default_flags = self.get_lit_bool('no_default_flags', False)
if not no_default_flags:
diff --git a/libcxx/test/lit.site.cfg.in b/libcxx/test/lit.site.cfg.in
index fb6f47a..a1ae90c 100644
--- a/libcxx/test/lit.site.cfg.in
+++ b/libcxx/test/lit.site.cfg.in
@@ -22,7 +22,9 @@ 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@"
+config.has_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
+config.use_libatomic = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@"
+
config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@"
# Let the main config do the real work.