Index: llvm/trunk/test/tools/llvm-objdump/non-archive-object.test =================================================================== --- llvm/trunk/test/tools/llvm-objdump/non-archive-object.test +++ llvm/trunk/test/tools/llvm-objdump/non-archive-object.test @@ -0,0 +1,25 @@ +# RUN: yaml2obj %s > %t +# RUN: llvm-objdump -a %t | FileCheck %s + +# If this test has not crashed, then this test passed. +# CHECK: file format ELF64-x86-64 + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .bss + Type: SHT_NOBITS + Flags: [ SHF_ALLOC ] + AddressAlign: 0x0000000000000010 + Size: 64 + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + AddressAlign: 0x0000000000000010 + Content: "01234567" + Size: 4 + 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 @@ -2309,8 +2309,8 @@ outs() << ":\tfile format " << o->getFileFormatName() << "\n\n"; } - if (ArchiveHeaders && !MachOOpt) - printArchiveChild(a->getFileName(), *c); + if (ArchiveHeaders && !MachOOpt && c) + printArchiveChild(ArchiveName, *c); if (Disassemble) DisassembleObject(o, Relocations); if (Relocations && !Disassemble) @@ -2363,8 +2363,8 @@ << ":\tfile format COFF-import-file" << "\n\n"; - if (ArchiveHeaders && !MachOOpt) - printArchiveChild(A->getFileName(), *C); + if (ArchiveHeaders && !MachOOpt && C) + printArchiveChild(ArchiveName, *C); if (SymbolTable) printCOFFSymbolTable(I); }