[compiler-rt] r182389 - [asan] Do not invoke LSan hooks unless CAN_SANITIZE_LEAKS.
Sergey Matveev
earthdok at google.com
Tue May 21 08:35:35 PDT 2013
Author: smatveev
Date: Tue May 21 10:35:34 2013
New Revision: 182389
URL: http://llvm.org/viewvc/llvm-project?rev=182389&view=rev
Log:
[asan] Do not invoke LSan hooks unless CAN_SANITIZE_LEAKS.
Modified:
compiler-rt/trunk/lib/asan/asan_rtl.cc
compiler-rt/trunk/lib/lsan/lsan_common.cc
Modified: compiler-rt/trunk/lib/asan/asan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_rtl.cc?rev=182389&r1=182388&r2=182389&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_rtl.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_rtl.cc Tue May 21 10:35:34 2013
@@ -465,9 +465,11 @@ void __asan_init() {
Atexit(asan_atexit);
}
+#if CAN_SANITIZE_LEAKS
if (flags()->detect_leaks) {
Atexit(__lsan::DoLeakCheck);
}
+#endif
// interceptors
InitializeAsanInterceptors();
@@ -548,7 +550,9 @@ void __asan_init() {
main_thread->ThreadStart(internal_getpid());
force_interface_symbols(); // no-op.
+#if CAN_SANITIZE_LEAKS
__lsan::InitCommonLsan();
+#endif
InitializeAllocator();
Modified: compiler-rt/trunk/lib/lsan/lsan_common.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_common.cc?rev=182389&r1=182388&r2=182389&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Tue May 21 10:35:34 2013
@@ -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 @@ void LeakReport::PrintLargest(uptr max_l
remaining > 1 ? "s" : "");
}
}
-#else // CAN_SANITIZE_LEAKS
-void InitCommonLsan() {}
-void DoLeakCheck() {}
-#endif // CAN_SANITIZE_LEAKS
+
} // namespace __lsan
+#endif // CAN_SANITIZE_LEAKS
More information about the llvm-commits
mailing list