[PATCH] D13108: [compiler-rt] [lsan] Add support for AArch64

Adhemerval Zanella via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 10:22:06 PDT 2015


zatrazz created this revision.
zatrazz added reviewers: kcc, eugenis, pcc, rengolin, samsonov.
zatrazz added a subscriber: llvm-commits.
Herald added subscribers: rengolin, aemerson.

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).

http://reviews.llvm.org/D13108

Files:
  cmake/config-ix.cmake
  lib/lsan/lsan_allocator.cc
  lib/lsan/lsan_common.cc
  lib/lsan/lsan_common.h
  lib/sanitizer_common/sanitizer_linux.cc

Index: lib/sanitizer_common/sanitizer_linux.cc
===================================================================
--- lib/sanitizer_common/sanitizer_linux.cc
+++ lib/sanitizer_common/sanitizer_linux.cc
@@ -496,14 +496,17 @@
 // 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];
 };
 
Index: lib/lsan/lsan_common.h
===================================================================
--- lib/lsan/lsan_common.h
+++ lib/lsan/lsan_common.h
@@ -23,6 +23,7 @@
 #include "sanitizer_common/sanitizer_symbolizer.h"
 
 #if SANITIZER_LINUX && (defined(__x86_64__) || defined(__mips64)) \
+    || defined(__aarch64__) \
     && (SANITIZER_WORDSIZE == 64)
 #define CAN_SANITIZE_LEAKS 1
 #else
Index: lib/lsan/lsan_common.cc
===================================================================
--- lib/lsan/lsan_common.cc
+++ lib/lsan/lsan_common.cc
@@ -119,6 +119,8 @@
   return ((p >> 47) == 0);
 #elif defined(__mips64)
   return ((p >> 40) == 0);
+#elif defined(__aarch64__)
+  return ((p >> SANITIZER_AARCH64_VMA) == 0);
 #else
   return true;
 #endif
Index: lib/lsan/lsan_allocator.cc
===================================================================
--- lib/lsan/lsan_allocator.cc
+++ lib/lsan/lsan_allocator.cc
@@ -32,7 +32,7 @@
   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;
Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -260,7 +260,7 @@
 set(ALL_ASAN_SUPPORTED_ARCH ${X86_64} i386 i686 powerpc64 powerpc64le ${ARM32}
   ${ARM64} mips mipsel mips64 mips64el)
 set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el ${ARM64})
-set(ALL_LSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el)
+set(ALL_LSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el ${ARM64})
 set(ALL_MSAN_SUPPORTED_ARCH ${X86_64} mips64 mips64el ${ARM64})
 set(ALL_PROFILE_SUPPORTED_ARCH ${X86_64} i386 i686 ${ARM32} mips mips64
     mipsel mips64el ${ARM64} powerpc64 powerpc64le)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13108.35525.patch
Type: text/x-patch
Size: 2526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150923/6d920442/attachment.bin>


More information about the llvm-commits mailing list