[llvm] r211904 - llvm-objdump: don't assert if ELF file has no sections
Rafael EspĂndola
rafael.espindola at gmail.com
Mon Jun 30 08:41:16 PDT 2014
This needs a testcase.
On 27 June 2014 12:37, Ed Maste <emaste at freebsd.org> wrote:
> 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;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list