Skip to content

Commit 3d039f6

Browse files
ahunteugenis
authored andcommitted
[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
1 parent fd2b089 commit 3d039f6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,12 @@ static SymbolizerTool *ChooseExternalSymbolizer(LowLevelAllocator *allocator) {
408408
}
409409

410410
const char *binary_name = path ? StripModuleName(path) : "";
411+
static const char kLLVMSymbolizerPrefix[] = "llvm-symbolizer";
411412
if (path && path[0] == '\0') {
412413
VReport(2, "External symbolizer is explicitly disabled.\n");
413414
return nullptr;
414-
} else if (!internal_strcmp(binary_name, "llvm-symbolizer")) {
415+
} else if (!internal_strncmp(binary_name, kLLVMSymbolizerPrefix,
416+
internal_strlen(kLLVMSymbolizerPrefix))) {
415417
VReport(2, "Using llvm-symbolizer at user-specified path: %s\n", path);
416418
return new(*allocator) LLVMSymbolizer(path, allocator);
417419
} else if (!internal_strcmp(binary_name, "atos")) {

0 commit comments

Comments
 (0)