summaryrefslogtreecommitdiff
path: root/tools/obj2yaml/obj2yaml.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /tools/obj2yaml/obj2yaml.cpp
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
Diffstat (limited to 'tools/obj2yaml/obj2yaml.cpp')
-rw-r--r--tools/obj2yaml/obj2yaml.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/obj2yaml/obj2yaml.cpp b/tools/obj2yaml/obj2yaml.cpp
index ee6284da6e417..3f9373ee17e38 100644
--- a/tools/obj2yaml/obj2yaml.cpp
+++ b/tools/obj2yaml/obj2yaml.cpp
@@ -29,11 +29,15 @@ static std::error_code dumpObject(const ObjectFile &Obj) {
}
static std::error_code dumpInput(StringRef File) {
- ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(File);
- if (std::error_code EC = BinaryOrErr.getError())
- return EC;
+ Expected<OwningBinary<Binary>> BinaryOrErr = createBinary(File);
+ if (!BinaryOrErr)
+ return errorToErrorCode(BinaryOrErr.takeError());
Binary &Binary = *BinaryOrErr.get().getBinary();
+ // Universal MachO is not a subclass of ObjectFile, so it needs to be handled
+ // here with the other binary types.
+ if (Binary.isMachO() || Binary.isMachOUniversalBinary())
+ return macho2yaml(outs(), Binary);
// TODO: If this is an archive, then burst it and dump each entry
if (ObjectFile *Obj = dyn_cast<ObjectFile>(&Binary))
return dumpObject(*Obj);
@@ -46,7 +50,7 @@ cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"),
int main(int argc, char *argv[]) {
cl::ParseCommandLineOptions(argc, argv);
- sys::PrintStackTraceOnErrorSignal();
+ sys::PrintStackTraceOnErrorSignal(argv[0]);
PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.