https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/101432

Backport 3a4c7cc

Requested by: @aemerson

>From 7942172be3fd6fa77a73c08a3f5459feaa7572ab Mon Sep 17 00:00:00 2001
From: Amara Emerson <am...@apple.com>
Date: Wed, 31 Jul 2024 16:51:45 -0700
Subject: [PATCH] Forward declare OSSpinLockLock on MacOS since it's not
 shipped on the system. (#101392)

Fixes build errors on some SDKs.

rdar://132607572
(cherry picked from commit 3a4c7cc56c07b2db9010c2228fc7cb2a43dd9b2d)
---
 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 4d5423ec629d2..b63040446e53c 100644
--- a/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
+++ b/compiler-rt/lib/rtsan/rtsan_interceptors.cpp
@@ -21,6 +21,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 <stdint.h>
+extern "C" {
+typedef int32_t OSSpinLock;
+void OSSpinLockLock(volatile OSSpinLock *__lock);
+}
+#endif
+
 #include <libkern/OSAtomic.h>
 #include <os/lock.h>
 #endif

_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to