Skip to content

Commit

Permalink
[lsan] [aarch64] Add support for AArch64
Browse files Browse the repository at this point in the history
This patch add support for leak sanitizer for aarch64.  Similar to
MIPS it uses a SizeClassAllocator32 due VMA constraints (aarch64
currently supports 39 and 42-bit VMA).

It also fixes the android build issue.

llvm-svn: 250898
  • Loading branch information
zatrazz committed Oct 21, 2015
1 parent 8dedeb0 commit b0d5dd0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler-rt/cmake/config-ix.cmake
Expand Up @@ -267,7 +267,7 @@ set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64}
set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}
${MIPS32} ${MIPS64} ${PPC64})
set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
set(ALL_LSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64})
set(ALL_LSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})
set(ALL_PROFILE_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${PPC64}
${MIPS32} ${MIPS64})
Expand Down
2 changes: 1 addition & 1 deletion compiler-rt/lib/lsan/lsan_allocator.cc
Expand Up @@ -32,7 +32,7 @@ struct ChunkMetadata {
u32 stack_trace_id;
};

#if defined(__mips64)
#if defined(__mips64) || defined(__aarch64__)
static const uptr kMaxAllowedMallocSize = 4UL << 30;
static const uptr kRegionSizeLog = 20;
static const uptr kNumRegions = SANITIZER_MMAP_RANGE_SIZE >> kRegionSizeLog;
Expand Down
2 changes: 2 additions & 0 deletions compiler-rt/lib/lsan/lsan_common.cc
Expand Up @@ -119,6 +119,8 @@ static inline bool CanBeAHeapPointer(uptr p) {
return ((p >> 47) == 0);
#elif defined(__mips64)
return ((p >> 40) == 0);
#elif defined(__aarch64__)
return ((p >> SANITIZER_AARCH64_VMA) == 0);
#else
return true;
#endif
Expand Down
4 changes: 2 additions & 2 deletions compiler-rt/lib/lsan/lsan_common.h
Expand Up @@ -22,8 +22,8 @@
#include "sanitizer_common/sanitizer_stoptheworld.h"
#include "sanitizer_common/sanitizer_symbolizer.h"

#if SANITIZER_LINUX && (defined(__x86_64__) || defined(__mips64)) \
&& (SANITIZER_WORDSIZE == 64)
#if (SANITIZER_LINUX && !SANITIZER_ANDROID) && (SANITIZER_WORDSIZE == 64) \
&& (defined(__x86_64__) || defined(__mips64) || defined(__aarch64__))
#define CAN_SANITIZE_LEAKS 1
#else
#define CAN_SANITIZE_LEAKS 0
Expand Down
5 changes: 4 additions & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_linux.cc
Expand Up @@ -497,14 +497,17 @@ void BlockingMutex::CheckLocked() {
// Note that getdents64 uses a different structure format. We only provide the
// 32-bit syscall here.
struct linux_dirent {
#if SANITIZER_X32
#if SANITIZER_X32 || defined(__aarch64__)
u64 d_ino;
u64 d_off;
#else
unsigned long d_ino;
unsigned long d_off;
#endif
unsigned short d_reclen;
#ifdef __aarch64__
unsigned char d_type;
#endif
char d_name[256];
};

Expand Down

0 comments on commit b0d5dd0

Please sign in to comment.