[libcxxabi] r293166 - Fix chromium build (libcxxabi)

Asiri Rathnayake via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 26 02:38:03 PST 2017


Author: asiri
Date: Thu Jan 26 04:38:03 2017
New Revision: 293166

URL: http://llvm.org/viewvc/llvm-project?rev=293166&view=rev
Log:
Fix chromium build (libcxxabi)

Pull the dependency on pthread_mach_thread_np() back into libcxxabi.

Modified:
    libcxxabi/trunk/src/cxa_guard.cpp

Modified: libcxxabi/trunk/src/cxa_guard.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_guard.cpp?rev=293166&r1=293165&r2=293166&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_guard.cpp (original)
+++ libcxxabi/trunk/src/cxa_guard.cpp Thu Jan 26 04:38:03 2017
@@ -179,7 +179,19 @@ _LIBCXXABI_FUNC_VIS int __cxa_guard_acqu
     if (result)
     {
 #if defined(__APPLE__) && !defined(__arm__)
-        const lock_type id = std::__libcpp_thread_get_port();
+        // This is a special-case pthread dependency for Mac. We can't pull this
+        // out into libcxx's threading API (__threading_support) because not all
+        // supported Mac environments provide this function (in pthread.h). To
+        // make it possible to build/use libcxx in those environments, we have to
+        // keep this pthread dependency local to libcxxabi. If there is some
+        // convenient way to detect precisely when pthread_mach_thread_np is
+        // available in a given Mac environment, it might still be possible to
+        // bury this dependency in __threading_support.
+        #ifdef _LIBCPP_HAS_THREAD_API_PTHREAD
+           const lock_type id = pthread_mach_thread_np(std::__libcpp_thread_get_current_id());
+        #else
+           #error "How do I pthread_mach_thread_np()?"
+        #endif
         lock_type lock = get_lock(*guard_object);
         if (lock)
         {




More information about the cfe-commits mailing list