[LLVMbugs] [Bug 14723] New: ELFObjectFile::isSectionZeroInit() checks the wrong bits

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 26 15:21:29 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=14723

             Bug #: 14723
           Summary: ELFObjectFile::isSectionZeroInit() checks the wrong
                    bits
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: sami.liedes at iki.fi
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


There's a test in ELFObjectFile::isSectionZeroInit() that seems bogus to me and
that fails to recognize a BSS section in my /bin/ls as zero-initialized.

I believe this change should fix the problem:

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

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list