[PATCH] D133795: Don't populate the symbol table with symbols that don't belong to a section with the flag SHF_ALLOC
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 13 15:31:41 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG13f1bc41888e: Don't populate the symbol table with symbols that don't belong to a section… (authored by gw280, committed by dblaikie).
Changed prior to commit:
https://reviews.llvm.org/D133795?vs=459822&id=459899#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133795/new/
https://reviews.llvm.org/D133795
Files:
llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml
Index: llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml
===================================================================
--- llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml
+++ llvm/test/DebugInfo/Symbolize/ELF/symtab-file2.yaml
@@ -73,3 +73,39 @@
Index: SHN_ABS
- Name: local
Section: .text
+
+# RUN: yaml2obj --docnum=3 %s -o %t3
+# RUN: llvm-symbolizer --obj=%t3 'DATA 0x1001' 2>&1 | FileCheck %s --check-prefix=CHECK3
+
+# CHECK3: code
+# CHECK3-NEXT: 4096 2
+# CHECK3-NEXT: ??:?
+# CHECK3-EMPTY:
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_DYN
+ Machine: EM_X86_64
+Sections:
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x1000
+ Size: 1
+ - Name: .debug
+ Type: SHT_PROGBITS
+ Address: 0x0000
+ Size: 0xFFFF
+Symbols:
+ - Name: debug
+ Section: .debug
+ Binding: STB_WEAK
+ Value: 0x1001
+ Size: 0
+ - Name: code
+ Section: .text
+ Binding: STB_WEAK
+ Value: 0x1000
+ Size: 2
Index: llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
===================================================================
--- llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
+++ llvm/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
@@ -168,6 +168,11 @@
return SymbolTypeOrErr.takeError();
SymbolRef::Type SymbolType = *SymbolTypeOrErr;
if (Obj.isELF()) {
+ // Ignore any symbols coming from sections that don't have runtime
+ // allocated memory.
+ if ((elf_section_iterator(*Sec)->getFlags() & ELF::SHF_ALLOC) == 0)
+ return Error::success();
+
// Allow function and data symbols. Additionally allow STT_NONE, which are
// common for functions defined in assembly.
uint8_t Type = ELFSymbolRef(Symbol).getELFType();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133795.459899.patch
Type: text/x-patch
Size: 1860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220913/ddc96dc9/attachment-0001.bin>
More information about the llvm-commits
mailing list