summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
index 453c51f1f26..4679dd862b9 100644
--- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
+++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
@@ -729,6 +729,10 @@ public:
std::vector<std::unique_ptr<File> > &result) const {
StringRef magic(input.getBuffer().getBufferStart(),
input.getBuffer().getBufferSize());
+ // The input file should be an archive file, a regular COFF file, or an an
+ // import library member file. Try to parse in that order. If the input file
+ // does not start with a known magic, parseCOFFImportLibrary will return an
+ // error object.
llvm::sys::fs::file_magic fileType = llvm::sys::fs::identify_magic(magic);
if (fileType == llvm::sys::fs::file_magic::archive)
return _readerArchive.parseFile(input, result);
OpenPOWER on IntegriCloud