From b880c129ecf5ea92135a5a208642c96f25073e54 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 27 Jun 2014 16:37:20 +0000 Subject: [PATCH] llvm-objdump: don't assert if ELF file has no sections FreeBSD core files, for example, have no sections (only program headers). llvm.org/pr20139 Differential Revision: http://reviews.llvm.org/D4323 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211904 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ELF.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index 716b3b93c0e..c968295b840 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -602,7 +602,7 @@ void ELFFile::VerifyStrTab(const Elf_Shdr *sh) const { template uint64_t ELFFile::getNumSections() const { assert(Header && "Header not initialized!"); - if (Header->e_shnum == ELF::SHN_UNDEF) { + if (Header->e_shnum == ELF::SHN_UNDEF && Header->e_shoff > 0) { assert(SectionHeaderTable && "SectionHeaderTable not initialized!"); return SectionHeaderTable->sh_size; } -- 2.34.1