From 7ab42e075ff450251a6372cd9b26905e21be77a3 Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Wed, 31 Jul 2024 12:40:27 -0700 Subject: [PATCH] Forward declare OSSpinLockLock on MacOS since it's not shipped on the system. Fixes build errors on some SDKs. rdar://132607572 --- compiler-rt/lib/rtsan/rtsan_interceptors.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp index 3a65f9d3f779d..e8e7bdf17d822 100644 --- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp +++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp @@ -17,6 +17,18 @@ #include "rtsan/rtsan_context.h" #if SANITIZER_APPLE + +#if TARGET_OS_MAC +// On MacOS OSSpinLockLock is deprecated and no longer present in the headers, +// but the symbol still exists on the system. Forward declare here so we +// don't get compilation errors. +#include +extern "C" { +typedef int32_t OSSpinLock; +void OSSpinLockLock(volatile OSSpinLock *__lock); +} +#endif + #include #include #endif