[compiler-rt] r308908 - Prefer atos to llvm-symbolizer on Darwin

George Karpenkov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 11:24:08 PDT 2017


Author: george.karpenkov
Date: Mon Jul 24 11:24:08 2017
New Revision: 308908

URL: http://llvm.org/viewvc/llvm-project?rev=308908&view=rev
Log:
Prefer atos to llvm-symbolizer on Darwin

atos is the default symbolizer on Apple's compiler for quite a few years now.
llvm-symbolizer is quite fragile on Darwin: for example, unless a .dSYM
file was explicitly generated symbolication would not work.
It is also very convenient when the behavior of LLVM open source
compiler matches to that of Apple's compiler on Apple's platform.
Furthermore, llvm-symbolizer is not installed on Apple's platform by
default, which leads to strange behavior during debugging: the test
might fail under lit (where it has llvm-symbolizer) but would run
properly when launched on the command line (where it does not, and atos
would be used).

Indeed, there's a downside: atos does not work properly with inlined
functions, hence the test change.
We do not think that this is a major problem, as users would often
compile with -O0 when debugging, and in any case it is preferable to
symbolizer not being able to symbolize.

Differential Revision: https://reviews.llvm.org/D35745

Added:
    compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-function.cc
      - copied, changed from r308907, compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc
Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
    compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc?rev=308908&r1=308907&r2=308908&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc Mon Jul 24 11:24:08 2017
@@ -471,16 +471,16 @@ static SymbolizerTool *ChooseExternalSym
 
   // Otherwise symbolizer program is unknown, let's search $PATH
   CHECK(path == nullptr);
-  if (const char *found_path = FindPathToBinary("llvm-symbolizer")) {
-    VReport(2, "Using llvm-symbolizer found at: %s\n", found_path);
-    return new(*allocator) LLVMSymbolizer(found_path, allocator);
-  }
 #if SANITIZER_MAC
   if (const char *found_path = FindPathToBinary("atos")) {
     VReport(2, "Using atos found at: %s\n", found_path);
     return new(*allocator) AtosSymbolizer(found_path, allocator);
   }
 #endif  // SANITIZER_MAC
+  if (const char *found_path = FindPathToBinary("llvm-symbolizer")) {
+    VReport(2, "Using llvm-symbolizer found at: %s\n", found_path);
+    return new(*allocator) LLVMSymbolizer(found_path, allocator);
+  }
   if (common_flags()->allow_addr2line) {
     if (const char *found_path = FindPathToBinary("addr2line")) {
       VReport(2, "Using addr2line found at: %s\n", found_path);

Copied: compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-function.cc (from r308907, compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-function.cc?p2=compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-function.cc&p1=compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc&r1=308907&r2=308908&rev=308908&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/Darwin/suppressions-function.cc Mon Jul 24 11:24:08 2017
@@ -4,10 +4,7 @@
 
 // RUN: echo "interceptor_via_fun:crash_function" > %t.supp
 // RUN: %clangxx_asan -O0 %s -o %t && %env_asan_opts=suppressions='"%t.supp"' %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s
-// RUN: %clangxx_asan -O3 %s -o %t && %env_asan_opts=suppressions='"%t.supp"' %run %t 2>&1 | FileCheck --check-prefix=CHECK-IGNORE %s
 
-// FIXME: Windows symbolizer needs work to make this pass.
-// XFAIL: android,win32
 // UNSUPPORTED: ios
 
 #include <stdio.h>

Modified: compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc?rev=308908&r1=308907&r2=308908&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/suppressions-function.cc Mon Jul 24 11:24:08 2017
@@ -10,6 +10,10 @@
 // XFAIL: android,win32
 // UNSUPPORTED: ios
 
+// FIXME: atos does not work for inlined functions, yet llvm-symbolizer
+// does not always work with debug info on Darwin.
+// UNSUPPORTED: darwin
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>




More information about the llvm-commits mailing list