[compiler-rt] [rtsan] Intercept aligned_alloc on all versions of OSX if available on build machine (PR #112780)
Chris Apple via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 14:44:53 PDT 2024
================
@@ -120,13 +120,17 @@ TEST(TestRtsanInterceptors, VallocDiesWhenRealtime) {
ExpectNonRealtimeSurvival(Func);
}
-#if SANITIZER_INTERCEPT_ALIGNED_ALLOC
TEST(TestRtsanInterceptors, AlignedAllocDiesWhenRealtime) {
- auto Func = []() { EXPECT_NE(nullptr, aligned_alloc(16, 32)); };
- ExpectRealtimeDeath(Func, "aligned_alloc");
- ExpectNonRealtimeSurvival(Func);
-}
+#if SANITIZER_APPLE
+ if (__builtin_available(macOS 10.15, *)) {
----------------
cjappl wrote:
This is the only place in compiler-rt that __builtin_available is used, is there a more preferable way to do this? If I don't, I get a warning that suggests this:
```
warning: 'aligned_alloc' is only available on macOS 10.15 or newer [-Wu
nguarded-availability-new]
...
_malloc.h:65:7: note: 'aligned_alloc' has been marked as being
introduced in macOS 10.15 here, but the deployment target is macOS 10.13.0
65 | void *aligned_alloc(size_t __alignment, size_t __size) __result_use_check __alloc_align(1) __alloc_size(2) _MALLOC_TYPED(malloc_type_aligned_alloc, 2) __OSX_AVAILABLE(10.15)
__IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
...
note: enclose 'aligned_alloc' in a __builtin_available check to silence
this warning
```
https://github.com/llvm/llvm-project/pull/112780
More information about the llvm-commits
mailing list