[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
Tue Oct 22 11:06:34 PDT 2024


================
@@ -461,6 +461,19 @@ INTERCEPTOR(void *, valloc, SIZE_T size) {
   return REAL(valloc)(size);
 }
 
+// aligned_alloc was introduced in OSX 10.15
+// Linking will fail when using an older SDK
+#if SANITIZER_APPLE && defined(__MAC_10_15)
----------------
cjappl wrote:

I moved it up in the latest commit. I initially did not put it on the top level to avoid any possible breakages with other sanitizers.

After looking, it seems like the only sanitizer that interacts with aligned_alloc outside of a *_linux.cpp file is lsan, and I feel reasonably confident this should work for that sanitizer with the weak import defined.

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


More information about the llvm-commits mailing list