summaryrefslogtreecommitdiff
path: root/lib/Object/ObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/ObjectFile.cpp')
-rw-r--r--lib/Object/ObjectFile.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Object/ObjectFile.cpp b/lib/Object/ObjectFile.cpp
index fd2b024687..6b14e78ff3 100644
--- a/lib/Object/ObjectFile.cpp
+++ b/lib/Object/ObjectFile.cpp
@@ -37,9 +37,11 @@ section_iterator ObjectFile::getRelocatedSection(DataRefImpl Sec) const {
return section_iterator(SectionRef(Sec, this));
}
-ErrorOr<ObjectFile *> ObjectFile::createObjectFile(MemoryBuffer *Object) {
+ErrorOr<ObjectFile *> ObjectFile::createObjectFile(MemoryBuffer *Object,
+ sys::fs::file_magic Type) {
OwningPtr<MemoryBuffer> ScopedObj(Object);
- sys::fs::file_magic Type = sys::fs::identify_magic(Object->getBuffer());
+ if (Type == sys::fs::file_magic::unknown)
+ Type = sys::fs::identify_magic(Object->getBuffer());
switch (Type) {
case sys::fs::file_magic::unknown: