readobj: Dump PE/COFF optional records.
These records are mandatory for executables and are used by the loader.
Reviewers: rafael
CC: llvm-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D939
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183852 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Object/Binary.cpp b/lib/Object/Binary.cpp
index 201899f..a149770 100644
--- a/lib/Object/Binary.cpp
+++ b/lib/Object/Binary.cpp
@@ -84,8 +84,10 @@
}
case sys::fs::file_magic::coff_object:
case sys::fs::file_magic::pecoff_executable: {
- OwningPtr<Binary> ret(new COFFObjectFile(scopedSource.take(), ec));
- if (ec) return ec;
+ OwningPtr<Binary> ret(
+ ObjectFile::createCOFFObjectFile(scopedSource.take()));
+ if (!ret)
+ return object_error::invalid_file_type;
Result.swap(ret);
return object_error::success;
}