diff --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-symbols.test b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-symbols.test --- a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-dynamic-symbols.test +++ b/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 diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -840,7 +840,7 @@ std::map &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());