[llvm-commits] [compiler-rt] r164772 - /compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Sep 27 06:20:40 PDT 2012


Author: eugenis
Date: Thu Sep 27 08:20:40 2012
New Revision: 164772

URL: http://llvm.org/viewvc/llvm-project?rev=164772&view=rev
Log:
Quick fix data/bss detection in TSan.

The old way breaks when a module's bss is adjacent to the [heap] vm area.
Both ways are not very reliable, though.

Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc?rev=164772&r1=164771&r2=164772&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_platform_linux.cc Thu Sep 27 08:20:40 2012
@@ -153,7 +153,10 @@
   while (proc_maps.Next(&start, &end, &offset, name, ARRAY_SIZE(name))) {
     DPrintf("%p-%p %p %s\n", start, end, offset, name);
     bool is_data = offset != 0 && name[0] != 0;
-    bool is_bss = offset == 0 && name[0] == 0 && prev_is_data;
+    // BSS may get merged with [heap] in /proc/self/maps. This is not very
+    // reliable.
+    bool is_bss = offset == 0 &&
+      (name[0] == 0 || internal_strcmp(name, "[heap]") == 0) && prev_is_data;
     if (g_data_start == 0 && is_data)
       g_data_start = start;
     if (is_bss)





More information about the llvm-commits mailing list