#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/system_error.h"
+#include <system_error>
using namespace llvm;
using namespace llvm::object;
return 0;
}
+static int
+DumpVersionMin(const MachOObjectFile &Obj,
+ const MachOObjectFile::LoadCommandInfo &LCI) {
+ MachO::version_min_command VMLC = Obj.getVersionMinLoadCommand(LCI);
+ outs() << " ('version, " << VMLC.version << ")\n"
+ << " ('reserved, " << VMLC.reserved << ")\n";
+ return 0;
+}
+
+static int
+DumpDylibID(const MachOObjectFile &Obj,
+ const MachOObjectFile::LoadCommandInfo &LCI) {
+ MachO::dylib_command DLLC = Obj.getDylibIDLoadCommand(LCI);
+ outs() << " ('install_name', '" << LCI.Ptr + DLLC.dylib.name << "')\n"
+ << " ('timestamp, " << DLLC.dylib.timestamp << ")\n"
+ << " ('cur_version, " << DLLC.dylib.current_version << ")\n"
+ << " ('compat_version, " << DLLC.dylib.compatibility_version << ")\n";
+ return 0;
+}
+
static int DumpLoadCommand(const MachOObjectFile &Obj,
MachOObjectFile::LoadCommandInfo &LCI) {
switch (LCI.C.cmd) {
return DumpDataInCodeDataCommand(Obj, LCI);
case MachO::LC_LINKER_OPTIONS:
return DumpLinkerOptionsCommand(Obj, LCI);
+ case MachO::LC_VERSION_MIN_IPHONEOS:
+ case MachO::LC_VERSION_MIN_MACOSX:
+ return DumpVersionMin(Obj, LCI);
+ case MachO::LC_ID_DYLIB:
+ return DumpDylibID(Obj, LCI);
default:
Warning("unknown load command: " + Twine(LCI.C.cmd));
return 0;
cl::ParseCommandLineOptions(argc, argv, "llvm Mach-O dumping tool\n");
ErrorOr<Binary *> BinaryOrErr = createBinary(InputFile);
- if (error_code EC = BinaryOrErr.getError())
+ if (std::error_code EC = BinaryOrErr.getError())
return Error("unable to read input: '" + EC.message() + "'");
std::unique_ptr<Binary> Binary(BinaryOrErr.get());