Index: test/Object/readobj-absent.test =================================================================== --- /dev/null +++ test/Object/readobj-absent.test @@ -0,0 +1,2 @@ +// Don't crash if required information is absent +RUN: llvm-readobj -dyn-symbols %p/Inputs/trivial-object-test.elf-x86-64 Index: tools/llvm-readobj/ELFDumper.cpp =================================================================== --- tools/llvm-readobj/ELFDumper.cpp +++ tools/llvm-readobj/ELFDumper.cpp @@ -1152,6 +1152,8 @@ template void ELFDumper::printSymbolsHelper(bool IsDynamic) { const Elf_Shdr *Symtab = (IsDynamic) ? DotDynSymSec : DotSymtabSec; + if (!Symtab) + return; ErrorOr StrTableOrErr = Obj->getStringTableForSymtab(*Symtab); error(StrTableOrErr.getError()); StringRef StrTable = *StrTableOrErr;