[PATCH] Recognize 0x0000 as a COFF file magic.
Rui Ueyama
ruiu at google.com
Wed Nov 13 14:03:17 PST 2013
- added a test
Hi Bigcheese,
http://llvm-reviews.chandlerc.com/D2164
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2164?vs=5495&id=5519#toc
Files:
lib/Support/Path.cpp
unittests/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
Index: unittests/Support/Path.cpp
===================================================================
--- unittests/Support/Path.cpp
+++ unittests/Support/Path.cpp
@@ -418,6 +418,7 @@
const char archive[] = "!<arch>\x0A";
const char bitcode[] = "\xde\xc0\x17\x0b";
+const char coff_object[] = "\x00\x00";
const char elf_relocatable[] = { 0x7f, 'E', 'L', 'F', 1, 2, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1 };
const char macho_universal_binary[] = "\xca\xfe\xba\xbe...\0x00";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2164.2.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131113/4cb1cf74/attachment.bin>
More information about the llvm-commits
mailing list