Skip to content

Forward declare OSSpinLockLock on MacOS since it's not shipped on the system.#101392

Merged
aemerson merged 1 commit intollvm:mainfrom
aemerson:co2-main
Jul 31, 2024
Merged

Forward declare OSSpinLockLock on MacOS since it's not shipped on the system.#101392
aemerson merged 1 commit intollvm:mainfrom
aemerson:co2-main

Conversation

@aemerson
Copy link
Copy Markdown
Contributor

Fixes build errors on some SDKs.

rdar://132607572

… system.

Fixes build errors on some SDKs.

rdar://132607572
@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Jul 31, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Amara Emerson (aemerson)

Changes

Fixes build errors on some SDKs.

rdar://132607572


Full diff: https://github.com/llvm/llvm-project/pull/101392.diff

1 Files Affected:

  • (modified) compiler-rt/lib/rtsan/rtsan_interceptors.cpp (+12)
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 <stdint.h>
+extern "C" {
+typedef int32_t OSSpinLock;
+void OSSpinLockLock(volatile OSSpinLock *__lock);
+}
+#endif
+
 #include <libkern/OSAtomic.h>
 #include <os/lock.h>
 #endif

@aemerson
Copy link
Copy Markdown
Contributor Author

This fix was approved offline by @dougsonos

@aemerson aemerson merged commit 3a4c7cc into llvm:main Jul 31, 2024
@aemerson
Copy link
Copy Markdown
Contributor Author

/cherry-pick 3a4c7cc

@aemerson
Copy link
Copy Markdown
Contributor Author

But let's wait for post-commit builders to ok this before we merge to rel branch.

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 31, 2024
… system. (llvm#101392)

Fixes build errors on some SDKs.

rdar://132607572
(cherry picked from commit 3a4c7cc)
@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Jul 31, 2024

/pull-request #101432

@aemerson aemerson deleted the co2-main branch August 1, 2024 16:41
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Aug 5, 2024
… system. (llvm#101392)

Fixes build errors on some SDKs.

rdar://132607572
(cherry picked from commit 3a4c7cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants