4 changes: 4 additions & 0 deletions libcxx/test/libcxx/test/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,10 @@ def configure_link_flags_cxx_library(self):
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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external

// <condition_variable>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external

// <mutex>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external

// <mutex>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external

// <thread>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: libcpp-has-no-threads, libcpp-has-thread-api-external

// <thread>

Expand Down
1 change: 1 addition & 0 deletions libcxx/test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config.has_libatomic = "@LIBCXX_HAS_ATOMIC_LIB@"
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@"

# Let the main config do the real work.
lit_config.load_config(config, "@LIBCXX_SOURCE_DIR@/test/lit.cfg")
10 changes: 10 additions & 0 deletions libcxx/test/support/external_threads.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_BUILDING_EXTERNAL_THREADS
#include <__threading_support>