summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libcxx/src/algorithm.cpp5
-rw-r--r--libcxx/src/chrono.cpp4
-rw-r--r--libcxx/src/condition_variable.cpp4
-rw-r--r--libcxx/src/debug.cpp5
-rw-r--r--libcxx/src/experimental/memory_resource.cpp3
-rw-r--r--libcxx/src/filesystem/operations.cpp4
-rw-r--r--libcxx/src/memory.cpp3
-rw-r--r--libcxx/src/mutex.cpp6
-rw-r--r--libcxx/src/shared_mutex.cpp3
-rw-r--r--libcxx/src/thread.cpp4
-rw-r--r--libcxxabi/src/cxa_guard_impl.h5
-rw-r--r--libcxxabi/src/cxa_thread_atexit.cpp6
-rw-r--r--libcxxabi/src/fallback_malloc.cpp5
-rw-r--r--libunwind/src/AddressSpace.hpp3
-rw-r--r--libunwind/src/RWMutex.hpp3
15 files changed, 63 insertions, 0 deletions
diff --git a/libcxx/src/algorithm.cpp b/libcxx/src/algorithm.cpp
index 28e452f52df..5ce2a23b464 100644
--- a/libcxx/src/algorithm.cpp
+++ b/libcxx/src/algorithm.cpp
@@ -8,7 +8,12 @@
#include "algorithm"
#include "random"
+#ifndef _LIBCPP_HAS_NO_THREADS
#include "mutex"
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/src/chrono.cpp b/libcxx/src/chrono.cpp
index c1eb67b61d7..a2f88c94c07 100644
--- a/libcxx/src/chrono.cpp
+++ b/libcxx/src/chrono.cpp
@@ -37,6 +37,10 @@
#endif
#endif
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "rt")
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
diff --git a/libcxx/src/condition_variable.cpp b/libcxx/src/condition_variable.cpp
index 4022ff2e9ad..69264c680d9 100644
--- a/libcxx/src/condition_variable.cpp
+++ b/libcxx/src/condition_variable.cpp
@@ -15,6 +15,10 @@
#include "system_error"
#include "__undef_macros"
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_STD
condition_variable::~condition_variable()
diff --git a/libcxx/src/debug.cpp b/libcxx/src/debug.cpp
index 7fdf90c37d9..95024131011 100644
--- a/libcxx/src/debug.cpp
+++ b/libcxx/src/debug.cpp
@@ -13,7 +13,12 @@
#include "string"
#include "cstdio"
#include "__hash_table"
+#ifndef _LIBCPP_HAS_NO_THREADS
#include "mutex"
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/src/experimental/memory_resource.cpp b/libcxx/src/experimental/memory_resource.cpp
index 22bc12c1005..84c95080496 100644
--- a/libcxx/src/experimental/memory_resource.cpp
+++ b/libcxx/src/experimental/memory_resource.cpp
@@ -12,6 +12,9 @@
#include "atomic"
#elif !defined(_LIBCPP_HAS_NO_THREADS)
#include "mutex"
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp
index 5ba979ca905..319d9f65d73 100644
--- a/libcxx/src/filesystem/operations.cpp
+++ b/libcxx/src/filesystem/operations.cpp
@@ -44,6 +44,10 @@
#include <sys/time.h> // for gettimeofday and timeval
#endif // !defined(CLOCK_REALTIME)
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "rt")
+#endif
+
#if defined(_LIBCPP_COMPILER_GCC)
#if _GNUC_VER < 500
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
diff --git a/libcxx/src/memory.cpp b/libcxx/src/memory.cpp
index 8b05c3f1649..6df7226b357 100644
--- a/libcxx/src/memory.cpp
+++ b/libcxx/src/memory.cpp
@@ -10,6 +10,9 @@
#ifndef _LIBCPP_HAS_NO_THREADS
#include "mutex"
#include "thread"
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
#endif
#include "include/atomic_support.h"
diff --git a/libcxx/src/mutex.cpp b/libcxx/src/mutex.cpp
index cecb89b3399..d100f2df233 100644
--- a/libcxx/src/mutex.cpp
+++ b/libcxx/src/mutex.cpp
@@ -12,6 +12,12 @@
#include "include/atomic_support.h"
#include "__undef_macros"
+#ifndef _LIBCPP_HAS_NO_THREADS
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
diff --git a/libcxx/src/shared_mutex.cpp b/libcxx/src/shared_mutex.cpp
index e918e1bdf60..3f1aecfdfe1 100644
--- a/libcxx/src/shared_mutex.cpp
+++ b/libcxx/src/shared_mutex.cpp
@@ -10,6 +10,9 @@
#ifndef _LIBCPP_HAS_NO_THREADS
#include "shared_mutex"
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/libcxx/src/thread.cpp b/libcxx/src/thread.cpp
index 29b06fdf660..92690f66798 100644
--- a/libcxx/src/thread.cpp
+++ b/libcxx/src/thread.cpp
@@ -35,6 +35,10 @@
#include <windows.h>
#endif
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+
_LIBCPP_BEGIN_NAMESPACE_STD
thread::~thread()
diff --git a/libcxxabi/src/cxa_guard_impl.h b/libcxxabi/src/cxa_guard_impl.h
index 412099e6f4e..bd6b15fce6a 100644
--- a/libcxxabi/src/cxa_guard_impl.h
+++ b/libcxxabi/src/cxa_guard_impl.h
@@ -49,6 +49,11 @@
#include <stdlib.h>
#include <__threading_support>
+#ifndef _LIBCXXABI_HAS_NO_THREADS
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+#endif
// To make testing possible, this header is included from both cxa_guard.cpp
// and a number of tests.
diff --git a/libcxxabi/src/cxa_thread_atexit.cpp b/libcxxabi/src/cxa_thread_atexit.cpp
index da1df861708..38787f18fe3 100644
--- a/libcxxabi/src/cxa_thread_atexit.cpp
+++ b/libcxxabi/src/cxa_thread_atexit.cpp
@@ -9,6 +9,12 @@
#include "abort_message.h"
#include "cxxabi.h"
#include <__threading_support>
+#ifndef _LIBCXXABI_HAS_NO_THREADS
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+#endif
+
#include <cstdlib>
namespace __cxxabiv1 {
diff --git a/libcxxabi/src/fallback_malloc.cpp b/libcxxabi/src/fallback_malloc.cpp
index 8ec1eeefd84..bae0fa4ac23 100644
--- a/libcxxabi/src/fallback_malloc.cpp
+++ b/libcxxabi/src/fallback_malloc.cpp
@@ -12,6 +12,11 @@
#include "fallback_malloc.h"
#include <__threading_support>
+#ifndef _LIBCXXABI_HAS_NO_THREADS
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
+#endif
#include <cstdlib> // for malloc, calloc, free
#include <cstring> // for memset
diff --git a/libunwind/src/AddressSpace.hpp b/libunwind/src/AddressSpace.hpp
index fb370ad1e79..66439530309 100644
--- a/libunwind/src/AddressSpace.hpp
+++ b/libunwind/src/AddressSpace.hpp
@@ -27,6 +27,9 @@
#if _LIBUNWIND_USE_DLADDR
#include <dlfcn.h>
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "dl")
+#endif
#endif
#ifdef __APPLE__
diff --git a/libunwind/src/RWMutex.hpp b/libunwind/src/RWMutex.hpp
index 7a08bb2af32..4f234a77edf 100644
--- a/libunwind/src/RWMutex.hpp
+++ b/libunwind/src/RWMutex.hpp
@@ -17,6 +17,9 @@
#include <windows.h>
#elif !defined(_LIBUNWIND_HAS_NO_THREADS)
#include <pthread.h>
+#if defined(__unix__) && defined(__ELF__) && defined(__clang__)
+#pragma comment(lib, "pthread")
+#endif
#endif
namespace libunwind {
OpenPOWER on IntegriCloud