Author: Julian Lettner Date: 2020-02-05T10:57:21-08:00 New Revision: c32d809e9cae8da7d3016b6cb30e2a2a9c9e2762
URL: https://github.com/llvm/llvm-project/commit/c32d809e9cae8da7d3016b6cb30e2a2a9c9e2762 DIFF: https://github.com/llvm/llvm-project/commit/c32d809e9cae8da7d3016b6cb30e2a2a9c9e2762.diff LOG: [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 Added: Modified: compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp Removed: ################################################################################ diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_mac.cpp index aa29536d8616..91584914d868 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, _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits