syscall() has been deprecated and is not available on macOS 10.12.
Details
- Reviewers
jdoerfert yln AndreyChurbanov - Group Reviewers
Restricted Project - Commits
- rG09af378f49dc: [OpenMP] Fix build on macOS sdk 10.12 and newer
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks fine in general. Julian, any chance you could take a quick look at this? Or suggest someone who would be more appropriate? Thanks :)
openmp/runtime/src/kmp_wrapper_getpid.h | ||
---|---|---|
26 | I am not an expert on MacOS, but this #if looks wrong. Because on earlier systems macro __MAC_10_12 is not defined, thus making the comparison to always be TRUE, and the code on #else is then a dead code. Probably the comparison with the value of the macro (like 101200) could work instead. |
For the sanitizers we are going the route of requiring a SDK that isn't super old. Asking people/CI builders to upgrade to SDK 10.12 for building seems reasonable at this point (https://reviews.llvm.org/D74501).
Of course this doesn't solve the underlying issue of running on old systems (governed by the deployment target), but at least you can take advantage of the availability annotations in the SDK to do a proper runtime check.
In this particular case pthread_mach_thread_np seems to be a good general replacement (header says it's available since 10.4). I recommend just using it unconditionally.
I do not have commit access, someone has to commit the change for me (with attribution). Thanks
I am not an expert on MacOS, but this #if looks wrong. Because on earlier systems macro __MAC_10_12 is not defined, thus making the comparison to always be TRUE, and the code on #else is then a dead code.
Probably the comparison with the value of the macro (like 101200) could work instead.