[compiler-rt] 3d039f6 - [compiler-rt] PR#39514 Support versioned llvm-symbolizer binaries
Evgenii Stepanov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 11 18:29:28 PST 2021
Author: Andrzej Hunt
Date: 2021-03-11T18:29:06-08:00
New Revision: 3d039f65015f0e7878b77c542a89493dcdd755d0
URL: https://github.com/llvm/llvm-project/commit/3d039f65015f0e7878b77c542a89493dcdd755d0
DIFF: https://github.com/llvm/llvm-project/commit/3d039f65015f0e7878b77c542a89493dcdd755d0.diff
LOG: [compiler-rt] PR#39514 Support versioned llvm-symbolizer binaries
Some linux distributions produce versioned llvm-symbolizer binaries,
e.g. my llvm-11 installation puts the symbolizer binary at
/usr/bin/llvm-symbolizer-11.0.0 . However if you then try to run
a binary containing ASAN with
ASAN_SYMBOLIZER_PATH=..../llvm-symbolizer-FOO , it will fail on startup
with "isn't a known symbolizer".
Although it is possible to work around this by setting up symlinks,
that's kindof ugly - supporting versioned binaries is a nicer solution.
(There are now multiple stack overflow and blog posts talking about
this exact issue :) .)
Originally added in:
https://reviews.llvm.org/D8285
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D97682
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
index 76e1f2eeb929..4cd4b4636f0a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
@@ -408,10 +408,12 @@ static SymbolizerTool *ChooseExternalSymbolizer(LowLevelAllocator *allocator) {
}
const char *binary_name = path ? StripModuleName(path) : "";
+ static const char kLLVMSymbolizerPrefix[] = "llvm-symbolizer";
if (path && path[0] == '\0') {
VReport(2, "External symbolizer is explicitly disabled.\n");
return nullptr;
- } else if (!internal_strcmp(binary_name, "llvm-symbolizer")) {
+ } else if (!internal_strncmp(binary_name, kLLVMSymbolizerPrefix,
+ internal_strlen(kLLVMSymbolizerPrefix))) {
VReport(2, "Using llvm-symbolizer at user-specified path: %s\n", path);
return new(*allocator) LLVMSymbolizer(path, allocator);
} else if (!internal_strcmp(binary_name, "atos")) {
More information about the llvm-commits
mailing list