diff options
author | Rui Ueyama <ruiu@google.com> | 2013-11-15 21:22:02 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2013-11-15 21:22:02 +0000 |
commit | 8a631b2cbe2f8621eb3679a4898205da577453b7 (patch) | |
tree | 54ce815755814be364f60b3263be96586ba52112 /lib | |
parent | 0cbdb81de76274c3f1731d92dc09864d2277d690 (diff) | |
download | external_llvm-8a631b2cbe2f8621eb3679a4898205da577453b7.zip external_llvm-8a631b2cbe2f8621eb3679a4898205da577453b7.tar.gz external_llvm-8a631b2cbe2f8621eb3679a4898205da577453b7.tar.bz2 |
Path: Recognize COFF import library file magic.
Summary: Make identify_magic to recognize COFF import file.
Reviewers: Bigcheese
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2165
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194852 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp | 1 | ||||
-rw-r--r-- | lib/Object/Binary.cpp | 1 | ||||
-rw-r--r-- | lib/Object/ObjectFile.cpp | 1 | ||||
-rw-r--r-- | lib/Support/Path.cpp | 4 |
4 files changed, 7 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp index 6aa6576..2c068be 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp @@ -584,6 +584,7 @@ ObjectImage *RuntimeDyld::loadObject(ObjectBuffer *InputBuffer) { case sys::fs::file_magic::bitcode: case sys::fs::file_magic::archive: case sys::fs::file_magic::coff_object: + case sys::fs::file_magic::coff_import_library: case sys::fs::file_magic::pecoff_executable: case sys::fs::file_magic::macho_universal_binary: case sys::fs::file_magic::windows_resource: diff --git a/lib/Object/Binary.cpp b/lib/Object/Binary.cpp index d0a7009..de57b4c 100644 --- a/lib/Object/Binary.cpp +++ b/lib/Object/Binary.cpp @@ -91,6 +91,7 @@ error_code object::createBinary(MemoryBuffer *Source, return object_error::success; } case sys::fs::file_magic::coff_object: + case sys::fs::file_magic::coff_import_library: case sys::fs::file_magic::pecoff_executable: { OwningPtr<Binary> ret( ObjectFile::createCOFFObjectFile(scopedSource.take())); diff --git a/lib/Object/ObjectFile.cpp b/lib/Object/ObjectFile.cpp index 59395c6..0e626d6 100644 --- a/lib/Object/ObjectFile.cpp +++ b/lib/Object/ObjectFile.cpp @@ -69,6 +69,7 @@ ObjectFile *ObjectFile::createObjectFile(MemoryBuffer *Object) { case sys::fs::file_magic::macho_dsym_companion: return createMachOObjectFile(Object); case sys::fs::file_magic::coff_object: + case sys::fs::file_magic::coff_import_library: case sys::fs::file_magic::pecoff_executable: return createCOFFObjectFile(Object); } diff --git a/lib/Support/Path.cpp b/lib/Support/Path.cpp index dfa18aa..c869b30 100644 --- a/lib/Support/Path.cpp +++ b/lib/Support/Path.cpp @@ -848,6 +848,10 @@ error_code has_magic(const Twine &path, const Twine &magic, bool &result) { return file_magic::unknown; switch ((unsigned char)Magic[0]) { case 0x00: { + // COFF short import library file + if (Magic[1] == (char)0x00 && Magic[2] == (char)0xff && + Magic[3] == (char)0xff) + return file_magic::coff_import_library; // Windows resource file const char Expected[] = { 0, 0, 0, 0, '\x20', 0, 0, 0, '\xff' }; if (Magic.size() >= sizeof(Expected) && |