summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulian Lettner <julian.lettner@apple.com>2020-02-05 08:17:06 -0800
committerJulian Lettner <julian.lettner@apple.com>2020-02-05 10:57:21 -0800
commitc32d809e9cae8da7d3016b6cb30e2a2a9c9e2762 (patch)
tree778415abed51f3a2060219ee627b5ee3140f589d
parentd5361190993a5df779eee245a18ceb76a7947833 (diff)
downloadbcm5719-llvm-c32d809e9cae8da7d3016b6cb30e2a2a9c9e2762.tar.gz
bcm5719-llvm-c32d809e9cae8da7d3016b6cb30e2a2a9c9e2762.zip
[TSan] Ensure we can compile the runtime with older SDKs
One of my changes [1] included in this release silently bumped the minimal macOS SDK required for building the TSan runtime to SDK 10.12. Let's ensure release 10 does not unexpectedly break builders with old SDKs and add proper minimal SDK checking in CMake for subsequent releases. This fix `#ifdef`s out interceptors for newer APIs. Note that the resulting TSan runtime is less complete: when these newer APIs are used TSan will report false positives. Fixes llvm 10 release blocker: #44682 https://bugs.llvm.org/show_bug.cgi?id=44682 [1] 894abb46f891cba2e0ef581650f27f512a7824b4 Reviewed By: dmajor Differential Revision: https://reviews.llvm.org/D74059
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp
index aa29536d861..91584914d86 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp
@@ -23,9 +23,12 @@
#include <errno.h>
#include <libkern/OSAtomic.h>
#include <objc/objc-sync.h>
-#include <os/lock.h>
#include <sys/ucontext.h>
+#if defined(__has_include) && __has_include(<os/lock.h>)
+#include <os/lock.h>
+#endif
+
#if defined(__has_include) && __has_include(<xpc/xpc.h>)
#include <xpc/xpc.h>
#endif // #if defined(__has_include) && __has_include(<xpc/xpc.h>)
@@ -247,6 +250,8 @@ TSAN_INTERCEPTOR(void, os_lock_unlock, void *lock) {
REAL(os_lock_unlock)(lock);
}
+#if defined(__has_include) && __has_include(<os/lock.h>)
+
TSAN_INTERCEPTOR(void, os_unfair_lock_lock, os_unfair_lock_t lock) {
if (!cur_thread()->is_inited || cur_thread()->is_dead) {
return REAL(os_unfair_lock_lock)(lock);
@@ -286,6 +291,8 @@ TSAN_INTERCEPTOR(void, os_unfair_lock_unlock, os_unfair_lock_t lock) {
REAL(os_unfair_lock_unlock)(lock);
}
+#endif // #if defined(__has_include) && __has_include(<os/lock.h>)
+
#if defined(__has_include) && __has_include(<xpc/xpc.h>)
TSAN_INTERCEPTOR(void, xpc_connection_set_event_handler,
OpenPOWER on IntegriCloud