summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2013-11-14 22:09:08 +0000
committerRui Ueyama <ruiu@google.com>2013-11-14 22:09:08 +0000
commit829c4392e18260a07e3692cf57e42a768ff5612c (patch)
tree330a85811957f339518edcd3308510bb1199d362 /llvm/lib/Support
parentfd675d932cf62f4bd7ce1352890637143f8f7c08 (diff)
downloadbcm5719-llvm-829c4392e18260a07e3692cf57e42a768ff5612c.tar.gz
bcm5719-llvm-829c4392e18260a07e3692cf57e42a768ff5612c.zip
Recognize 0x0000 as a COFF file magic.
Summary: 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. Reviewers: Bigcheese CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2164 llvm-svn: 194734
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/Path.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 7fc9ab89672..dfa18aaa6d2 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -853,6 +853,9 @@ error_code has_magic(const Twine &path, const Twine &magic, bool &result) {
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
OpenPOWER on IntegriCloud