[llvm] a7ceef9 - DebugInfo/Symbolize: Exclude ARM mapping symbols for .symtab symbolization after D95916
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 12 11:04:28 PST 2021
Author: Fangrui Song
Date: 2021-02-12T11:04:20-08:00
New Revision: a7ceef9254ad1ec112906f53ac9cae2f0a37e4bb
URL: https://github.com/llvm/llvm-project/commit/a7ceef9254ad1ec112906f53ac9cae2f0a37e4bb
DIFF: https://github.com/llvm/llvm-project/commit/a7ceef9254ad1ec112906f53ac9cae2f0a37e4bb.diff
LOG: DebugInfo/Symbolize: Exclude ARM mapping symbols for .symtab symbolization after D95916
Their names don't convey much information, so they should be excluded.
The behavior matches addr2line.
Differential Revision: https://reviews.llvm.org/D96617
Added:
llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s
Modified:
llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
Removed:
################################################################################
diff --git a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
index 4a9b119e5dad..d7519998c67e 100644
--- a/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -174,6 +174,11 @@ Error SymbolizableObjectFile::addSymbol(const SymbolRef &Symbol,
if (Type != ELF::STT_NOTYPE && Type != ELF::STT_FUNC &&
Type != ELF::STT_OBJECT && Type != ELF::STT_GNU_IFUNC)
return Error::success();
+ // Some STT_NOTYPE symbols are not desired. This excludes STT_SECTION and
+ // ARM mapping symbols.
+ uint32_t Flags = cantFail(Symbol.getFlags());
+ if (Flags & SymbolRef::SF_FormatSpecific)
+ return Error::success();
} else if (SymbolType != SymbolRef::ST_Function &&
SymbolType != SymbolRef::ST_Data) {
return Error::success();
diff --git a/llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s b/llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s
new file mode 100644
index 000000000000..810ae4f5b8bd
--- /dev/null
+++ b/llvm/test/DebugInfo/Symbolize/ELF/arm-mapping-symbol.s
@@ -0,0 +1,19 @@
+# REQUIRES: arm-registered-target
+## Ignore ARM mapping symbols (with a prefix of $a, $d or $t).
+
+# RUN: llvm-mc -filetype=obj -triple=armv7-none-linux %s -o %t
+# RUN: llvm-symbolizer --obj=%t 4 8 | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple=thumbv7-none-linux %s -o %tthumb
+# RUN: llvm-symbolizer --obj=%tthumb 4 8 | FileCheck %s
+
+# CHECK: foo
+# CHECK-NEXT: ??:0:0
+# CHECK-EMPTY:
+# CHECK-NEXT: foo
+# CHECK-NEXT: ??:0:0
+
+.globl foo
+foo:
+ .word 32
+ nop
+ .word 32
More information about the llvm-commits
mailing list