<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - file_magic identifies file with two leading null bytes as a COFF object"
   href="https://bugs.llvm.org/show_bug.cgi?id=44683">44683</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>file_magic identifies file with two leading null bytes as a COFF object
          </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>enhancement
          </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>sbc@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is because the first two bytes of COFF is the machine type and machine
type 0 is IMAGE_FILE_MACHINE_UNKNOWN.

See:
<a href="https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types">https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#machine-types</a>

Is is a minor annoyance when dealing with rust archives because rust archives
because they seem to include a rust metadata file .. which means running
llvm-nm on them always generates a strange error such as:

`llvm-nm: error: libtest.a(rust.metadata.bin) The end of the file was
unexpectedly encountered
`

llvm-nm ignores non-object files but it thinks this file is a COFF object
becasue the file starts with bunch of leading zeros.

I think we can perhaps modify file_magic to be a little less eager when
identifying COFF objects.</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>