<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - COFF: Checksum value is always set to zero"
   href="http://llvm.org/bugs/show_bug.cgi?id=19666">19666</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>COFF: Checksum value is always set to zero
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Object
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:
<span class="quote">>>> hex(crcmod.mkCrcFun(0x104C11DB7, initCrc=0x00000000, rev=True, xorOut=0x00000000)("\01\00\00\00"))</span >
'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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>