[llvm-objdump] Fail early if we can't parse the object header.
authorDavide Italiano <davide@freebsd.org>
Sat, 19 Dec 2015 22:09:40 +0000 (22:09 +0000)
committerDavide Italiano <davide@freebsd.org>
Sat, 19 Dec 2015 22:09:40 +0000 (22:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256108 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-objdump/llvm-objdump.cpp

index d46ea38..3057a1d 100644 (file)
@@ -1527,13 +1527,14 @@ static void printFaultMaps(const ObjectFile *Obj) {
 }
 
 static void printPrivateFileHeader(const ObjectFile *o) {
-  if (o->isELF()) {
+  if (o->isELF())
     printELFFileHeader(o);
-  } else if (o->isCOFF()) {
+  else if (o->isCOFF())
     printCOFFFileHeader(o);
-  } else if (o->isMachO()) {
+  else if (o->isMachO())
     printMachOFileHeader(o);
-  }
+  else
+    report_fatal_error("Invalid/Unsupported object file format");
 }
 
 static void DumpObject(const ObjectFile *o) {