Skip to content

Commit f2c3523

Browse files
committed
[PR] fmayer - redef SANITIZER_ALIGNED_ALLOC as appopriate
1 parent 4c83de3 commit f2c3523

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,15 +463,18 @@ INTERCEPTOR(void *, valloc, SIZE_T size) {
463463

464464
// aligned_alloc was introduced in OSX 10.15
465465
// Linking will fail when using an older SDK
466-
#if defined(__MAC_10_15)
466+
#if SANITIZER_APPLE && defined(__MAC_10_15)
467467
// macOS 10.15 is greater than our minimal deployment target. To ensure we
468468
// generate a weak reference so the dylib continues to work on older
469469
// systems, we need to forward declare the intercepted function as "weak
470470
// imports".
471471
SANITIZER_WEAK_IMPORT void *aligned_alloc(SIZE_T __alignment, SIZE_T __size);
472-
#endif // defined(__MAC_10_15)
473472

474-
#if SANITIZER_INTERCEPT_ALIGNED_ALLOC || SANITIZER_APPLE
473+
#undef SANITIZER_INTERCEPT_ALIGNED_ALLOC
474+
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC 1
475+
#endif // SANITIZER_APPLE && defined(__MAC_10_15)
476+
477+
#if SANITIZER_INTERCEPT_ALIGNED_ALLOC
475478
INTERCEPTOR(void *, aligned_alloc, SIZE_T alignment, SIZE_T size) {
476479
__rtsan_notify_intercepted_call("aligned_alloc");
477480
return REAL(aligned_alloc)(alignment, size);

0 commit comments

Comments
 (0)