summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-06-07 19:13:38 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-06-07 19:13:38 +0000
commit688c3d3bf19a621d30743aaa43395836123225d1 (patch)
tree8c3c5998b31fbdb980d10b604403c8db6b901c31
parent3621857eace82a7a72b26e67f2b6be200566bdff (diff)
downloadbcm5719-llvm-688c3d3bf19a621d30743aaa43395836123225d1.tar.gz
bcm5719-llvm-688c3d3bf19a621d30743aaa43395836123225d1.zip
[asan] Turn LSan-related #if’s into regular if’s in ASan initializer
Removing some preprocessor #if’s in favor of regular if’s. However, we need to declare empty stub functions to avoid linker errors. Differential Revision: http://reviews.llvm.org/D20911 llvm-svn: 272047
-rw-r--r--compiler-rt/lib/asan/asan_rtl.cc16
-rw-r--r--compiler-rt/lib/lsan/lsan_common.cc7
2 files changed, 15 insertions, 8 deletions
diff --git a/compiler-rt/lib/asan/asan_rtl.cc b/compiler-rt/lib/asan/asan_rtl.cc
index b31c9905049..7fbdbcd8054 100644
--- a/compiler-rt/lib/asan/asan_rtl.cc
+++ b/compiler-rt/lib/asan/asan_rtl.cc
@@ -546,12 +546,12 @@ static void AsanInitInternal() {
force_interface_symbols(); // no-op.
SanitizerInitializeUnwinder();
-#if CAN_SANITIZE_LEAKS
- __lsan::InitCommonLsan();
- if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit) {
- Atexit(__lsan::DoLeakCheck);
+ if (CAN_SANITIZE_LEAKS) {
+ __lsan::InitCommonLsan();
+ if (common_flags()->detect_leaks && common_flags()->leak_check_at_exit) {
+ Atexit(__lsan::DoLeakCheck);
+ }
}
-#endif // CAN_SANITIZE_LEAKS
#if CAN_SANITIZE_UB
__ubsan::InitAsPlugin();
@@ -559,12 +559,12 @@ static void AsanInitInternal() {
InitializeSuppressions();
- {
-#if CAN_SANITIZE_LEAKS
+ if (CAN_SANITIZE_LEAKS) {
// LateInitialize() calls dlsym, which can allocate an error string buffer
// in the TLS. Let's ignore the allocation to avoid reporting a leak.
__lsan::ScopedInterceptorDisabler disabler;
-#endif
+ Symbolizer::LateInitialize();
+ } else {
Symbolizer::LateInitialize();
}
diff --git a/compiler-rt/lib/lsan/lsan_common.cc b/compiler-rt/lib/lsan/lsan_common.cc
index 58ccab58cdb..888a25b206c 100644
--- a/compiler-rt/lib/lsan/lsan_common.cc
+++ b/compiler-rt/lib/lsan/lsan_common.cc
@@ -650,6 +650,13 @@ uptr LeakReport::UnsuppressedLeakCount() {
}
} // namespace __lsan
+#else // CAN_SANITIZE_LEAKS
+namespace __lsan {
+void InitCommonLsan() { }
+void DoLeakCheck() { }
+void DisableInThisThread() { }
+void EnableInThisThread() { }
+}
#endif // CAN_SANITIZE_LEAKS
using namespace __lsan; // NOLINT
OpenPOWER on IntegriCloud