diff --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h --- a/compiler-rt/lib/lsan/lsan_common.h +++ b/compiler-rt/lib/lsan/lsan_common.h @@ -29,18 +29,14 @@ // To enable LeakSanitizer on a new architecture, one needs to implement the // internal_clone function as well as (probably) adjust the TLS machinery for // the new architecture inside the sanitizer library. -#if (SANITIZER_LINUX && \ - (!SANITIZER_ANDROID || defined(ANDROID_HAS_ELF_TLS)) || \ - SANITIZER_MAC) && \ - (SANITIZER_WORDSIZE == 64) && \ - (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \ +#if (SANITIZER_LINUX && || SANITIZER_MAC) && (SANITIZER_WORDSIZE == 64) && \ + (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__) || \ defined(__powerpc64__) || defined(__s390x__)) #define CAN_SANITIZE_LEAKS 1 -#elif defined(__i386__) && \ - (SANITIZER_LINUX && \ - (!SANITIZER_ANDROID || defined(ANDROID_HAS_ELF_TLS)) || \ - SANITIZER_MAC) +#elif defined(__i386__) && (SANITIZER_LINUX || SANITIZER_MAC) #define CAN_SANITIZE_LEAKS 1 +// Exclude leak-detection on arm32 for Android because `__aeabi_read_tp` +// is missing. This caused a link error. #elif defined(__arm__) && SANITIZER_LINUX && !SANITIZER_ANDROID #define CAN_SANITIZE_LEAKS 1 #elif SANITIZER_NETBSD || SANITIZER_FUCHSIA diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux.h @@ -160,12 +160,10 @@ pid_t, void (*cb)(void *, void *, uptr, void *), void *); #define HAS_ANDROID_THREAD_PROPERTIES_API (&__libc_iterate_dynamic_tls != 0) - -#else -#define HAS_ANDROID_THREAD_PROPERTIES_API (0) #endif // SANITIZER_ANDROID } // namespace __sanitizer #endif +#define HAS_ANDROID_THREAD_PROPERTIES_API (0) #endif // SANITIZER_LINUX_H