From 3e564e985f7f26a7eb1401ec87754df4f1124bbb Mon Sep 17 00:00:00 2001 From: Francis Ricci Date: Mon, 27 Mar 2017 19:42:37 +0000 Subject: [PATCH] Move lsan allocator cache from lsan_common_linux to lsan_linux Having this function in common seems to trigger a lot of unrelated test failures. Given that this isn't really common code anyway, move this to a new linux-specific lsan file. llvm-svn: 298878 --- compiler-rt/lib/lsan/CMakeLists.txt | 1 + compiler-rt/lib/lsan/lsan_common_linux.cc | 4 ---- compiler-rt/lib/lsan/lsan_linux.cc | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 compiler-rt/lib/lsan/lsan_linux.cc diff --git a/compiler-rt/lib/lsan/CMakeLists.txt b/compiler-rt/lib/lsan/CMakeLists.txt index a48b85f..4e66100 100644 --- a/compiler-rt/lib/lsan/CMakeLists.txt +++ b/compiler-rt/lib/lsan/CMakeLists.txt @@ -11,6 +11,7 @@ set(LSAN_COMMON_SOURCES set(LSAN_SOURCES lsan.cc lsan_allocator.cc + lsan_linux.cc lsan_interceptors.cc lsan_preinit.cc lsan_thread.cc) diff --git a/compiler-rt/lib/lsan/lsan_common_linux.cc b/compiler-rt/lib/lsan/lsan_common_linux.cc index e73768e..0e10d41 100644 --- a/compiler-rt/lib/lsan/lsan_common_linux.cc +++ b/compiler-rt/lib/lsan/lsan_common_linux.cc @@ -22,7 +22,6 @@ #include "sanitizer_common/sanitizer_flags.h" #include "sanitizer_common/sanitizer_linux.h" #include "sanitizer_common/sanitizer_stackdepot.h" -#include "lsan_allocator.h" namespace __lsan { @@ -39,9 +38,6 @@ static THREADLOCAL u32 current_thread_tid = kInvalidTid; u32 GetCurrentThread() { return current_thread_tid; } void SetCurrentThread(u32 tid) { current_thread_tid = tid; } -static THREADLOCAL AllocatorCache allocator_cache; -AllocatorCache *GetAllocatorCache() { return &allocator_cache; } - __attribute__((tls_model("initial-exec"))) THREADLOCAL int disable_counter; bool DisabledInThisThread() { return disable_counter > 0; } diff --git a/compiler-rt/lib/lsan/lsan_linux.cc b/compiler-rt/lib/lsan/lsan_linux.cc new file mode 100644 index 0000000..616c06c --- /dev/null +++ b/compiler-rt/lib/lsan/lsan_linux.cc @@ -0,0 +1,26 @@ +//=-- lsan_linux.cc -------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file is a part of LeakSanitizer. Linux-specific code. +// +//===----------------------------------------------------------------------===// + +#if SANITIZER_LINUX + +#include "lsan_allocator.h" + +namespace __lsan { + +static THREADLOCAL AllocatorCache allocator_cache; +AllocatorCache *GetAllocatorCache() { return &allocator_cache; } + +} // namespace __lsan + +#endif // CAN_SANITIZE_LEAKS && SANITIZER_LINUX + -- 2.7.4