Index: llvm/trunk/test/tools/llvm-objdump/X86/demangle.s =================================================================== --- llvm/trunk/test/tools/llvm-objdump/X86/demangle.s +++ llvm/trunk/test/tools/llvm-objdump/X86/demangle.s @@ -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. Index: llvm/trunk/test/tools/llvm-objdump/X86/out-of-section-sym.test =================================================================== --- llvm/trunk/test/tools/llvm-objdump/X86/out-of-section-sym.test +++ llvm/trunk/test/tools/llvm-objdump/X86/out-of-section-sym.test @@ -6,7 +6,6 @@ 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 Index: llvm/trunk/test/tools/llvm-objdump/symbol-table-elf.test =================================================================== --- llvm/trunk/test/tools/llvm-objdump/symbol-table-elf.test +++ llvm/trunk/test/tools/llvm-objdump/symbol-table-elf.test @@ -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 Index: llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp =================================================================== --- llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp +++ llvm/trunk/tools/llvm-objdump/llvm-objdump.cpp @@ -2015,7 +2015,14 @@ 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(o)) + continue; + + const SymbolRef &Symbol = *I; Expected AddressOrError = Symbol.getAddress(); if (!AddressOrError) report_error(ArchiveName, o->getFileName(), AddressOrError.takeError(),