[PATCH] [asan] Do not invoke LSan hooks unless CAN_SANITIZE_LEAKS.

Sergey Matveev earthdok at google.com
Tue May 21 08:27:48 PDT 2013


Hi kcc, glider,

This should fix the bots.

http://llvm-reviews.chandlerc.com/D836

Files:
  lib/asan/asan_rtl.cc
  lib/lsan/lsan_common.cc

Index: lib/asan/asan_rtl.cc
===================================================================
--- lib/asan/asan_rtl.cc
+++ lib/asan/asan_rtl.cc
@@ -465,9 +465,11 @@
     Atexit(asan_atexit);
   }
 
+#if CAN_SANITIZE_LEAKS
   if (flags()->detect_leaks) {
     Atexit(__lsan::DoLeakCheck);
   }
+#endif
 
   // interceptors
   InitializeAsanInterceptors();
@@ -548,7 +550,9 @@
   main_thread->ThreadStart(internal_getpid());
   force_interface_symbols();  // no-op.
 
+#if CAN_SANITIZE_LEAKS
   __lsan::InitCommonLsan();
+#endif
 
   InitializeAllocator();
 
Index: lib/lsan/lsan_common.cc
===================================================================
--- lib/lsan/lsan_common.cc
+++ lib/lsan/lsan_common.cc
@@ -20,8 +20,9 @@
 #include "sanitizer_common/sanitizer_stacktrace.h"
 #include "sanitizer_common/sanitizer_stoptheworld.h"
 
-namespace __lsan {
 #if CAN_SANITIZE_LEAKS
+namespace __lsan {
+
 Flags lsan_flags;
 
 static void InitializeFlags() {
@@ -381,8 +382,6 @@
            remaining > 1 ? "s" : "");
   }
 }
-#else  // CAN_SANITIZE_LEAKS
-void InitCommonLsan() {}
-void DoLeakCheck() {}
-#endif  // CAN_SANITIZE_LEAKS
+
 }  // namespace __lsan
+#endif  // CAN_SANITIZE_LEAKS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D836.1.patch
Type: text/x-patch
Size: 1194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130521/639b8eb0/attachment.bin>


More information about the llvm-commits mailing list