[LLVMbugs] [Bug 19666] New: COFF: Checksum value is always set to zero

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 6 13:14:23 PDT 2014


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

            Bug ID: 19666
           Summary: COFF: Checksum value is always set to zero
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Object
          Assignee: unassignedbugs at nondot.org
          Reporter: david.majnemer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

consider:

__declspec(naked) void fun() {
  __asm add DWORD PTR [eax], eax
  __asm add BYTE PTR [eax], al
}

if you compile with /O2, MSVC will give you an object file with:

         COMDAT; sym= "void __cdecl fun(void)" (?fun@@YAXXZ)
         16 byte align
         Execute Read

RAW DATA #3
  00000000: 01 00 00 00                                      ....

    Section length    4, #relocs    0, #linenums    0, checksum B8BC6765,
selection    1 (pick no duplicates)
008 00000000 SECT3  notype ()    External     | ?fun@@YAXXZ (void __cdecl
fun(void))

This seems to be the following CRC:
>>> hex(crcmod.mkCrcFun(0x104C11DB7, initCrc=0x00000000, rev=True, xorOut=0x00000000)("\01\00\00\00"))
'0xb8bc6765L'

It appears that they are willing to perform COMDAT folding so long as the CRC
values correspond and manually check any collisions.
They don't seem to re-CRC the data to verify that the contents are valid. This
means that ICF will fire even if all CRCs are zero.

However, it will have to consider far more collisions if we don't vary the
checksum we place in the object file.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140506/2e32d1b4/attachment.html>


More information about the llvm-bugs mailing list