From 28e41fed078ce7a457a1ab8de1b07407266695fb Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Mon, 25 Nov 2013 17:40:17 +0000 Subject: Merging r195652: ------------------------------------------------------------------------ r195652 | smatveev | 2013-11-25 19:54:31 +0400 (Mon, 25 Nov 2013) | 3 lines [lsan] Unbreak lsan_testlib.cc. Also, add missing logging output. ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/branches/release_34@195668 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/lsan/lsan_common.cc | 2 ++ lib/lsan/lsan_preinit.cc | 6 +++++- lib/lsan/tests/lsan_testlib.cc | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc index 18354e9e8..152588411 100644 --- a/lib/lsan/lsan_common.cc +++ b/lib/lsan/lsan_common.cc @@ -275,6 +275,8 @@ static void ClassifyAllChunks(SuspendedThreadsList const &suspended_threads) { // The check here is relatively expensive, so we do this in a separate flood // fill. That way we can skip the check for chunks that are reachable // otherwise. + if (flags()->log_pointers) + Report("Processing platform-specific allocations.\n"); ProcessPlatformSpecificAllocations(&frontier); FloodFillTag(&frontier, kReachable); diff --git a/lib/lsan/lsan_preinit.cc b/lib/lsan/lsan_preinit.cc index a631f9a3e..e6639516d 100644 --- a/lib/lsan/lsan_preinit.cc +++ b/lib/lsan/lsan_preinit.cc @@ -14,7 +14,11 @@ #include "lsan.h" -#if !defined(PIC) +#ifndef LSAN_USE_PREINIT_ARRAY +#define LSAN_USE_PREINIT_ARRAY 1 +#endif + +#if LSAN_USE_PREINIT_ARRAY && !defined(PIC) // We force __lsan_init to be called before anyone else by placing it into // .preinit_array section. __attribute__((section(".preinit_array"), used)) diff --git a/lib/lsan/tests/lsan_testlib.cc b/lib/lsan/tests/lsan_testlib.cc index 363cc14f1..8db6cf1e2 100644 --- a/lib/lsan/tests/lsan_testlib.cc +++ b/lib/lsan/tests/lsan_testlib.cc @@ -14,12 +14,12 @@ /* Usage: clang++ ../sanitizer_common/sanitizer_*.cc ../interception/interception_*.cc \ lsan*.cc tests/lsan_testlib.cc -I. -I.. -g -ldl -lpthread -fPIC -shared -O2 \ - -o lsan.so + -DLSAN_USE_PREINIT_ARRAY=0 -o lsan.so LD_PRELOAD=./lsan.so /your/app */ #include "lsan.h" __attribute__((constructor)) void constructor() { - __lsan::Init(); + __lsan_init(); } -- cgit v1.2.1