[compiler-rt] Allow building the profiler runtime on tvOS and watchOS (PR #180704)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 10 00:49:46 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Mads Marquart (madsmtm)
<details>
<summary>Changes</summary>
These platforms do not have `fork`, it is marked as `__TVOS_PROHIBITED` and `__WATCHOS_PROHIBITED` in the header.
Allows Rust to ship a prebuilt profiler runtime, see https://github.com/rust-lang/rust/issues/152426.
CC @<!-- -->isanbard. I don't have the ability to merge the PR myself.
---
Full diff: https://github.com/llvm/llvm-project/pull/180704.diff
1 Files Affected:
- (modified) compiler-rt/lib/profile/GCDAProfiling.c (+9-1)
``````````diff
diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c
index 523ade5eafc15..da2cfdcf14eaf 100644
--- a/compiler-rt/lib/profile/GCDAProfiling.c
+++ b/compiler-rt/lib/profile/GCDAProfiling.c
@@ -44,6 +44,13 @@
#include <unistd.h>
#endif
+#if defined(__APPLE__)
+#include <TargetConditionals.h>
+#else
+#define TARGET_OS_TV 0
+#define TARGET_OS_WATCH 0
+#endif
+
#include "InstrProfiling.h"
#include "InstrProfilingUtil.h"
@@ -589,7 +596,8 @@ void llvm_reset_counters(void) {
}
}
-#if !defined(_WIN32) && !defined(__wasm__)
+// `fork` is not available on Windows, WASM, tvOS or watchOS.
+#if !defined(_WIN32) && !defined(__wasm__) && !TARGET_OS_TV && !TARGET_OS_WATCH
COMPILER_RT_VISIBILITY
pid_t __gcov_fork() {
pid_t parent_pid = getpid();
``````````
</details>
https://github.com/llvm/llvm-project/pull/180704
More information about the llvm-commits
mailing list