Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -166,6 +166,9 @@ option(LIBCXX_HAS_EXTERNAL_THREAD_API "Build libc++ with an externalized threading API. This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF) +option(LIBCXXABI_HAS_EXTERNAL_THREAD_API + "Build libc++abi with an externalized threading API. + This option may only be set to ON when LIBCXXABI_ENABLE_THREADS=ON." OFF) # Misc options ---------------------------------------------------------------- # FIXME: Turn -pedantic back ON. It is currently off because it warns @@ -218,14 +221,21 @@ " when LIBCXX_ENABLE_THREADS is also set to OFF.") endif() -if(LIBCXX_HAS_PTHREAD_API AND NOT LIBCXX_ENABLE_THREADS) - message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON" - " when LIBCXX_ENABLE_THREADS is also set to ON.") +if(NOT LIBCXX_ENABLE_THREADS) + if(LIBCXX_HAS_PTHREAD_API) + message(FATAL_ERROR "LIBCXX_HAS_PTHREAD_API can only be set to ON" + " when LIBCXX_ENABLE_THREADS is also set to ON.") + endif() + if(LIBCXX_HAS_EXTERNAL_THREAD_API) + message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON" + " when LIBCXX_ENABLE_THREADS is also set to ON.") + endif() endif() -if(LIBCXX_HAS_EXTERNAL_THREAD_API AND NOT LIBCXX_ENABLE_THREADS) - message(FATAL_ERROR "LIBCXX_HAS_EXTERNAL_THREAD_API can only be set to ON" - " when LIBCXX_ENABLE_THREADS is also set to ON.") +if(LIBCXX_HAS_PTHREAD_API AND LIBCXX_HAS_EXTERNAL_THREAD_API) + message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API" + "and LIBCXX_HAS_PTHREAD_API cannot be both" + "set to ON at the same time.") endif() # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE Index: lib/CMakeLists.txt =================================================================== --- lib/CMakeLists.txt +++ lib/CMakeLists.txt @@ -257,7 +257,7 @@ PROPERTIES LINK_FLAGS "${LIBCXX_LINK_FLAGS}" COMPILE_FLAGS "${LIBCXX_COMPILE_FLAGS}" - OUTPUT_NAME "c++external_threads" + OUTPUT_NAME "cxx_external_threads" ) endif() Index: test/CMakeLists.txt =================================================================== --- test/CMakeLists.txt +++ test/CMakeLists.txt @@ -35,6 +35,7 @@ pythonize_bool(LIBCXX_HAS_ATOMIC_LIB) pythonize_bool(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB) pythonize_bool(LIBCXX_HAS_EXTERNAL_THREAD_API) +pythonize_bool(LIBCXXABI_HAS_EXTERNAL_THREAD_API) # By default, for non-standalone builds, libcxx and libcxxabi share a library # directory. @@ -56,17 +57,23 @@ @ONLY) if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) - set(experimental_dep cxx_experimental) + set(LIBCXX_TEST_DEPS cxx_experimental) +else() + set(LIBCXX_TEST_DEPS "") endif() if (LIBCXX_HAS_EXTERNAL_THREAD_API) - set(external_threads_dep cxx_external_threads) + list(APPEND LIBCXX_TEST_DEPS "cxx_external_threads") +endif() + +if (LIBCXXABI_HAS_EXTERNAL_THREAD_API) + list(APPEND LIBCXX_TEST_DEPS "cxxabi_external_threads") endif() add_lit_testsuite(check-cxx "Running libcxx tests" ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS cxx ${experimental_dep} ${external_threads_dep}) + DEPENDS cxx ${LIBCXX_TEST_DEPS}) add_custom_target(check-libcxx DEPENDS check-cxx) Index: test/libcxx/test/config.py =================================================================== --- test/libcxx/test/config.py +++ test/libcxx/test/config.py @@ -571,10 +571,6 @@ self.cxx.link_flags += [abs_path] else: self.cxx.link_flags += ['-lc++'] - # This needs to come after -lc++ as we want its unresolved thread-api symbols - # to be picked up from this one. - if self.get_lit_bool('libcxx_external_thread_api', default=False): - self.cxx.link_flags += ['-lc++external_threads'] def configure_link_flags_abi_library(self): cxx_abi = self.get_lit_conf('cxx_abi', 'libcxxabi') @@ -603,6 +599,10 @@ 'C++ ABI setting %s unsupported for tests' % cxx_abi) def configure_extra_library_flags(self): + if self.get_lit_bool('cxx_ext_threads', default=False): + self.cxx.link_flags += ['-lcxx_external_threads'] + if self.get_lit_bool('cxxabi_ext_threads', default=False): + self.cxx.link_flags += ['-lcxxabi_external_threads'] self.target_info.add_cxx_link_flags(self.cxx.link_flags) def configure_color_diagnostics(self): Index: test/lit.site.cfg.in =================================================================== --- test/lit.site.cfg.in +++ test/lit.site.cfg.in @@ -28,7 +28,8 @@ config.use_libatomic = "@LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB@" config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@" -config.libcxx_external_thread_api = "@LIBCXX_HAS_EXTERNAL_THREAD_API@" +config.cxx_ext_threads = "@LIBCXX_HAS_EXTERNAL_THREAD_API@" +config.cxxabi_ext_threads = "@LIBCXXABI_HAS_EXTERNAL_THREAD_API@" # Let the main config do the real work. config.loaded_site_config = True