forked from OSchip/llvm-project
[llvm-objdump] - Do not include reserved undefined symbol in -t output.
This is https://bugs.llvm.org/show_bug.cgi?id=26892, GNU objdump hides the special symbol entry: SYMBOL TABLE: 000000000000a7e0 l F .text 00000000000003f9 bi_copymodules while llvm-objdump does not: SYMBOL TABLE: 0000000000000000 *UND* 00000000 000000000000a7e0 l F .text 000003f9 bi_copymodules Patch makes the behavior of the llvm-objdump to be consistent with the GNU objdump. Differential revision: https://reviews.llvm.org/D56076 llvm-svn: 350840
This commit is contained in:
parent
4817c0e46c
commit
8e0a70be24
|
@ -6,7 +6,6 @@
|
|||
|
||||
## Check we demangle symbols when printing symbol table.
|
||||
# CHECK: SYMBOL TABLE:
|
||||
# CHECK-NEXT: 0000000000000000 *UND* 00000000
|
||||
# CHECK-NEXT: 0000000000000000 g F .text 00000000 foo()
|
||||
|
||||
## Check the case when relocations are inlined into disassembly.
|
||||
|
|
|
@ -6,7 +6,6 @@ CHECK: Disassembly of section .text:
|
|||
CHECK-NEXT: _start:
|
||||
CHECK-NEXT: 10: c3 retl
|
||||
CHECK-NEXT: SYMBOL TABLE:
|
||||
CHECK-NEXT: 00000000 *UND* 00000000
|
||||
CHECK-NEXT: 00000010 l d .text 00000000 .text
|
||||
CHECK-NEXT: 00000010 .text 00000000 _start
|
||||
CHECK-NEXT: 00000020 .text 00000000 _fdata
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
# RUN: FileCheck %s --input-file=%t1
|
||||
|
||||
# CHECK: SYMBOL TABLE:
|
||||
# CHECK-NEXT: 0000000000000000 *UND* 00000000
|
||||
# CHECK-NEXT: 0000000000001004 l F .text 00000000 lfoo
|
||||
# CHECK-NEXT: 0000000000001008 l O .text 00000000 lbar
|
||||
# CHECK-NEXT: 0000000000001004 g F .text 00000000 foo
|
||||
|
|
|
@ -2015,7 +2015,14 @@ void llvm::PrintSymbolTable(const ObjectFile *o, StringRef ArchiveName,
|
|||
printCOFFSymbolTable(coff);
|
||||
return;
|
||||
}
|
||||
for (const SymbolRef &Symbol : o->symbols()) {
|
||||
|
||||
for (auto I = o->symbol_begin(), E = o->symbol_end(); I != E; ++I) {
|
||||
// Skip printing the special zero symbol when dumping an ELF file.
|
||||
// This makes the output consistent with the GNU objdump.
|
||||
if (I == o->symbol_begin() && isa<ELFObjectFileBase>(o))
|
||||
continue;
|
||||
|
||||
const SymbolRef &Symbol = *I;
|
||||
Expected<uint64_t> AddressOrError = Symbol.getAddress();
|
||||
if (!AddressOrError)
|
||||
report_error(ArchiveName, o->getFileName(), AddressOrError.takeError(),
|
||||
|
|
Loading…
Reference in New Issue