[compiler-rt] [compiler-rt/darwin] Disable building sanitizers on platforms without fork(). (PR #83485)

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 13:59:26 PST 2024


jyknight wrote:

FWIW, last time I looked at this a few years ago, from what I could tell, tvOS/watchOS _do_ have fork/etc calls. They're marked as "unavailable", but that's only an issue with the headers. Apple actually does ship these libraries (containing calls to fork/etc!), so I suspect they internally have a build option which disables the "unavailable" annotations.

It seemed that modifying the `Availability.h` header to define `__WATCHOS_PROHIBITED`, `__TVOS_PROHIBITED`, and `__API_UNAVAILABLE(...)` as no-op macros does let the sanitizers libraries build successfully.

So, if someone wanted to, they could probably fix the compiler-rt cmake to support building the sanitizer runtimes on these platforms just by creating a wrapper `Availability.h` file to undef/redefine those macros as no-ops, and putting it on the include path ahead of the system headers.

https://github.com/llvm/llvm-project/pull/83485


More information about the llvm-commits mailing list