Skip to content

Commit 55e1021

Browse files
committed
[PR] vitalybuka - clean up header
1 parent 1e127da commit 55e1021

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,22 @@
8686

8787
#if SANITIZER_APPLE
8888
# include <Availability.h>
89-
#endif
89+
90+
// aligned_alloc was introduced in OSX 10.15
91+
// Linking will fail when using an older SDK
92+
# if defined(__MAC_10_15)
93+
// macOS 10.15 is greater than our minimal deployment target. To ensure we
94+
// generate a weak reference so the dylib continues to work on older
95+
// systems, we need to forward declare the intercepted function as "weak
96+
// imports".
97+
SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
98+
__sanitizer::usize __size);
99+
# define SI_MAC_SDK_10_15_AVAILABLE 1
100+
# else
101+
# define SI_MAC_SDK_10_15_AVAILABLE 0
102+
# endif // defined(__MAC_10_15)
103+
104+
#endif // SANITIZER_APPLE
90105

91106
#if SANITIZER_IOS
92107
#define SI_IOS 1
@@ -507,27 +522,8 @@
507522
#define SANITIZER_INTERCEPT_PVALLOC (SI_GLIBC || SI_ANDROID)
508523
#define SANITIZER_INTERCEPT_CFREE (SI_GLIBC && !SANITIZER_RISCV64)
509524
#define SANITIZER_INTERCEPT_REALLOCARRAY SI_POSIX
510-
511-
#if SANITIZER_APPLE && defined(__MAC_10_15)
512-
# define SI_MAC_SDK_10_15_AVAILABLE 1
513-
#else
514-
# define SI_MAC_SDK_10_15_AVAILABLE 0
515-
#endif // SANITIZER_APPLE && defined(__MAC_10_15)
516-
517-
// aligned_alloc was introduced in OSX 10.15
518-
// Linking will fail when using an older SDK
519-
#if SI_MAC_SDK_10_15_AVAILABLE
520-
// macOS 10.15 is greater than our minimal deployment target. To ensure we
521-
// generate a weak reference so the dylib continues to work on older
522-
// systems, we need to forward declare the intercepted function as "weak
523-
// imports".
524-
SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
525-
__sanitizer::usize __size);
526-
#endif // SI_MAC_SDK_10_15_AVAILABLE
527-
528525
#define SANITIZER_INTERCEPT_ALIGNED_ALLOC \
529526
(!SI_MAC || SI_MAC_SDK_10_15_AVAILABLE)
530-
531527
#define SANITIZER_INTERCEPT_MALLOC_USABLE_SIZE (!SI_MAC && !SI_NETBSD)
532528
#define SANITIZER_INTERCEPT_MCHECK_MPROBE SI_LINUX_NOT_ANDROID
533529
#define SANITIZER_INTERCEPT_WCSLEN 1

0 commit comments

Comments
 (0)