[compiler-rt] r195652 - [lsan] Unbreak lsan_testlib.cc.

Sergey Matveev earthdok at google.com
Mon Nov 25 07:54:31 PST 2013


Author: smatveev
Date: Mon Nov 25 09:54:31 2013
New Revision: 195652

URL: http://llvm.org/viewvc/llvm-project?rev=195652&view=rev
Log:
[lsan] Unbreak lsan_testlib.cc.

Also, add missing logging output.

Modified:
    compiler-rt/trunk/lib/lsan/lsan_common.cc
    compiler-rt/trunk/lib/lsan/lsan_preinit.cc
    compiler-rt/trunk/lib/lsan/tests/lsan_testlib.cc

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=195652&r1=195651&r2=195652&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_common.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_common.cc Mon Nov 25 09:54:31 2013
@@ -275,6 +275,8 @@ static void ClassifyAllChunks(SuspendedT
   // 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);
 

Modified: compiler-rt/trunk/lib/lsan/lsan_preinit.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/lsan_preinit.cc?rev=195652&r1=195651&r2=195652&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/lsan_preinit.cc (original)
+++ compiler-rt/trunk/lib/lsan/lsan_preinit.cc Mon Nov 25 09:54:31 2013
@@ -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))

Modified: compiler-rt/trunk/lib/lsan/tests/lsan_testlib.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/lsan/tests/lsan_testlib.cc?rev=195652&r1=195651&r2=195652&view=diff
==============================================================================
--- compiler-rt/trunk/lib/lsan/tests/lsan_testlib.cc (original)
+++ compiler-rt/trunk/lib/lsan/tests/lsan_testlib.cc Mon Nov 25 09:54:31 2013
@@ -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();
 }





More information about the llvm-commits mailing list