[llvm-commits] [PATCH 1/3] Fix bits check in ELFObjectFile::isSectionZeroInit().

Roman Divacky rdivacky at freebsd.org
Fri Dec 28 01:17:16 PST 2012


Why not?

Result = sec->sh_type == ELF::SHT_NOBITS;

On Fri, Dec 28, 2012 at 01:20:30AM +0200, Sami Liedes wrote:
> The bits test in ELFObjectFile::isSectionZeroInit() is bogus. Fix it.
> 
> Fixes PR14723.

> diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h
> index 1634789..acfb493 100644
> --- a/include/llvm/Object/ELF.h
> +++ b/include/llvm/Object/ELF.h
> @@ -1306,7 +1306,7 @@ error_code ELFObjectFile<target_endianness, is64Bits>
>    const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
>    // For ELF, all zero-init sections are virtual (that is, they occupy no space
>    //   in the object image) and vice versa.
> -  if (sec->sh_flags & ELF::SHT_NOBITS)
> +  if (sec->sh_type == ELF::SHT_NOBITS)
>      Result = true;
>    else
>      Result = false;

> _______________________________________________
> 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