[PATCH] D58146: [symbolizer] Avoid collecting symbols belonging to invalid sections.
Matt Davis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 14 15:54:20 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354083: [symbolizer] Avoid collecting symbols belonging to invalid sections. (authored by mattd, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D58146?vs=186535&id=186934#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58146/new/
https://reviews.llvm.org/D58146
Files:
llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
llvm/trunk/test/tools/llvm-symbolizer/ignore-undefined-symbols.s
Index: llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
===================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -136,6 +136,11 @@
uint64_t SymbolSize,
DataExtractor *OpdExtractor,
uint64_t OpdAddress) {
+ // Avoid adding symbols from an unknown/undefined section.
+ const ObjectFile *Obj = Symbol.getObject();
+ Expected<section_iterator> Sec = Symbol.getSection();
+ if (!Sec || (Obj && Obj->section_end() == *Sec))
+ return std::error_code();
Expected<SymbolRef::Type> SymbolTypeOrErr = Symbol.getType();
if (!SymbolTypeOrErr)
return errorToErrorCode(SymbolTypeOrErr.takeError());
Index: llvm/trunk/test/tools/llvm-symbolizer/ignore-undefined-symbols.s
===================================================================
--- llvm/trunk/test/tools/llvm-symbolizer/ignore-undefined-symbols.s
+++ llvm/trunk/test/tools/llvm-symbolizer/ignore-undefined-symbols.s
@@ -0,0 +1,12 @@
+# REQUIRES: x86-registered-target
+# RUN: llvm-mc --filetype=obj --triple=x86_64-pc-linux %s -o %t.o -g
+# RUN: llvm-symbolizer --obj=%t.o 0 | FileCheck %s --implicit-check-not=bar
+
+# CHECK: foo
+# CHECK-NEXT: ignore-undefined-symbols.s:12:0
+
+.type bar, at function
+.type foo, at function
+.global foo
+foo:
+ call bar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58146.186934.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190214/26c06b6f/attachment.bin>
More information about the llvm-commits
mailing list