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
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;
}