diff options
Diffstat (limited to 'tools/macho-dump/macho-dump.cpp')
-rw-r--r-- | tools/macho-dump/macho-dump.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tools/macho-dump/macho-dump.cpp b/tools/macho-dump/macho-dump.cpp index 886487b..7600979 100644 --- a/tools/macho-dump/macho-dump.cpp +++ b/tools/macho-dump/macho-dump.cpp @@ -20,7 +20,7 @@ #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; @@ -328,6 +328,17 @@ DumpVersionMin(const MachOObjectFile &Obj, 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) { @@ -350,6 +361,8 @@ static int DumpLoadCommand(const MachOObjectFile &Obj, 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; @@ -391,7 +404,7 @@ int main(int argc, char **argv) { 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()); |