Skip to content

Commit

Permalink
[LSAN] Enabled only with __ANDROID_API__ >= 28
Browse files Browse the repository at this point in the history
Code does not work as-is with emulated tls even if
lsan is disabled with runtime flag.
  • Loading branch information
vitalybuka committed Nov 5, 2020
1 parent 4455f3c commit 61e59eb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions compiler-rt/lib/lsan/lsan_common.h
Expand Up @@ -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
Expand Down

2 comments on commit 61e59eb

@smeenai
Copy link
Collaborator

@smeenai smeenai commented on 61e59eb Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to use 28 here? ELF TLS was introduced in API level 29: https://developer.android.com/about/versions/10/features#elf-tls

@vitalybuka
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Maybe a mistake. But I believe LSAN support is unfinished on android.

Please sign in to comment.