[PATCH] Recognize 0x0000 as a COFF file magic.

Rui Ueyama ruiu at google.com
Tue Nov 12 22:45:19 PST 2013


Hi Bigcheese,

Some machine-type-neutral object files containing only undefined symbols
actually do exist in the Windows standard library. Need to recognize them
as COFF files.

http://llvm-reviews.chandlerc.com/D2164

Files:
  lib/Support/Path.cpp

Index: lib/Support/Path.cpp
===================================================================
--- lib/Support/Path.cpp
+++ lib/Support/Path.cpp
@@ -853,6 +853,9 @@
       if (Magic.size() >= sizeof(Expected) &&
           memcmp(Magic.data(), Expected, sizeof(Expected)) == 0)
         return file_magic::windows_resource;
+      // 0x0000 = COFF unknown machine type
+      if (Magic[1] == 0)
+        return file_magic::coff_object;
       break;
     }
     case 0xDE:  // 0x0B17C0DE = BC wraper
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2164.1.patch
Type: text/x-patch
Size: 501 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131112/b1e75d8e/attachment.bin>


More information about the llvm-commits mailing list