[llvm] r211904 - llvm-objdump: don't assert if ELF file has no sections
Ed Maste
emaste at freebsd.org
Fri Jun 27 09:37:20 PDT 2014
Author: emaste
Date: Fri Jun 27 11:37:20 2014
New Revision: 211904
URL: http://llvm.org/viewvc/llvm-project?rev=211904&view=rev
Log:
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
Modified:
llvm/trunk/include/llvm/Object/ELF.h
Modified: llvm/trunk/include/llvm/Object/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=211904&r1=211903&r2=211904&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELF.h (original)
+++ llvm/trunk/include/llvm/Object/ELF.h Fri Jun 27 11:37:20 2014
@@ -602,7 +602,7 @@ void ELFFile<ELFT>::VerifyStrTab(const E
template <class ELFT>
uint64_t ELFFile<ELFT>::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;
}
More information about the llvm-commits
mailing list