[compiler-rt] 61e59eb - [LSAN] Enabled only with __ANDROID_API__ >= 28

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 4 22:18:17 PST 2020


Author: Vitaly Buka
Date: 2020-11-04T22:18:05-08:00
New Revision: 61e59ebfa645caa3b89baaf51dd26a56625bc39f

URL: https://github.com/llvm/llvm-project/commit/61e59ebfa645caa3b89baaf51dd26a56625bc39f
DIFF: https://github.com/llvm/llvm-project/commit/61e59ebfa645caa3b89baaf51dd26a56625bc39f.diff

LOG: [LSAN] Enabled only with __ANDROID_API__ >= 28

Code does not work as-is with emulated tls even if
lsan is disabled with runtime flag.

Added: 
    

Modified: 
    compiler-rt/lib/lsan/lsan_common.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/lsan/lsan_common.h b/compiler-rt/lib/lsan/lsan_common.h
index b99ab4c85a5f..a26a8b37aa0b 100644
--- a/compiler-rt/lib/lsan/lsan_common.h
+++ b/compiler-rt/lib/lsan/lsan_common.h
@@ -29,15 +29,17 @@
 // 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_MAC) && (SANITIZER_WORDSIZE == 64) &&  \
+// Exclude leak-detection on arm32 for Android because `__aeabi_read_tp`
+// is missing. This caused a link error.
+#if SANITIZER_ANDROID && (__ANDROID_API__ < 28 || defined(__arm__))
+#define CAN_SANITIZE_LEAKS 0
+#elif (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_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
+#elif defined(__arm__) && SANITIZER_LINUX &&
 #define CAN_SANITIZE_LEAKS 1
 #elif SANITIZER_NETBSD || SANITIZER_FUCHSIA
 #define CAN_SANITIZE_LEAKS 1


        


More information about the llvm-commits mailing list