[PATCH] D62964: [llvm-objdump] Include dynamic zero-sized and non-function symbols in disassembly
Yuanfang Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 6 09:29:05 PDT 2019
tabloid.adroit created this revision.
tabloid.adroit added reviewers: jhenderson, grimar, MaskRay.
Herald added subscribers: llvm-commits, rupprecht.
Herald added a project: LLVM.
Only explicitly disallow STT_SECTION symbol in disassembly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D62964
Files:
llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-symbols.test
llvm/tools/llvm-objdump/llvm-objdump.cpp
Index: llvm/tools/llvm-objdump/llvm-objdump.cpp
===================================================================
--- llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -840,7 +840,7 @@
std::map<SectionRef, SectionSymbolsTy> &AllSymbols) {
for (auto Symbol : Obj->getDynamicSymbolIterators()) {
uint8_t SymbolType = Symbol.getELFType();
- if (SymbolType != ELF::STT_FUNC || Symbol.getSize() == 0)
+ if (SymbolType == ELF::STT_SECTION)
continue;
uint64_t Address = unwrapOrError(Symbol.getAddress(), Obj->getFileName());
Index: llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-symbols.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-symbols.test
+++ llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-symbols.test
@@ -22,9 +22,14 @@
# STATIC-EMPTY:
# STATIC-NEXT: 0000000000001002 only_static:
# CHECK-NEXT: 1002:
+# DYN-EMPTY:
+# DYN-NEXT: 0000000000001003 not_func:
# CHECK-NEXT: 1003:
+# DYN-EMPTY:
+# DYN-NEXT: 0000000000001004 zero_sized:
# CHECK-NEXT: 1004:
-# CHECK-NEXT: 1005:{{.*}}
+# CHECK-NEXT: 1005:
+# CHECK-NEXT: 1006:{{.*}}
# CHECK-NOT: {{.}}
--- !ELF
@@ -38,7 +43,7 @@
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
Address: 0x1000
- Content: 909090909090
+ Content: 90909090909090
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x1000
@@ -66,9 +71,6 @@
Size: 1
Type: STT_FUNC
Binding: STB_GLOBAL
- ## The rest of the dynamic symbols won't be used for various reasons.
- ## FIXME: the first two symbols here should be dumped.
- ## See https://bugs.llvm.org/show_bug.cgi?id=41947
- Name: not_func
Value: 0x1003
Section: .text
@@ -79,20 +81,27 @@
Section: .text
Type: STT_FUNC
Binding: STB_GLOBAL
- - Name: '' # No name
+ - Name: section_sym
Value: 0x1005
Section: .text
Size: 1
+ Type: STT_SECTION
+ Binding: STB_GLOBAL
+ ## The rest of the dynamic symbols won't be used for various reasons.
+ - Name: '' # No name
+ Value: 0x1006
+ Section: .text
+ Size: 1
Type: STT_FUNC
Binding: STB_GLOBAL
- Name: absolute
- Value: 0x1005
+ Value: 0x1006
Index: SHN_ABS
Size: 1
Type: STT_FUNC
Binding: STB_GLOBAL
- Name: undefined
- Value: 0x1005
+ Value: 0x1006
Index: SHN_UNDEF
Size: 1
Type: STT_FUNC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62964.203387.patch
Type: text/x-patch
Size: 2593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190606/94641a65/attachment.bin>
More information about the llvm-commits
mailing list