diff options
Diffstat (limited to 'tools/macho-dump')
-rw-r--r-- | tools/macho-dump/Makefile | 16 | ||||
-rw-r--r-- | tools/macho-dump/macho-dump.cpp | 28 |
2 files changed, 33 insertions, 11 deletions
diff --git a/tools/macho-dump/Makefile b/tools/macho-dump/Makefile index 638015e..0843e98 100644 --- a/tools/macho-dump/Makefile +++ b/tools/macho-dump/Makefile @@ -7,17 +7,11 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../.. -TOOLNAME = macho-dump +LEVEL := ../.. +TOOLNAME := macho-dump +LINK_COMPONENTS := support object # This tool has no plugins, optimize startup time. -TOOL_NO_EXPORTS = 1 - -# Include this here so we can get the configuration of the targets -# that have been configured for construction. We have to do this -# early so we can set up LINK_COMPONENTS before including Makefile.rules -include $(LEVEL)/Makefile.config - -LINK_COMPONENTS := support object +TOOL_NO_EXPORTS := 1 -include $(LLVM_SRC_ROOT)/Makefile.rules +include $(LEVEL)/Makefile.common diff --git a/tools/macho-dump/macho-dump.cpp b/tools/macho-dump/macho-dump.cpp index f324259..2b22c3b 100644 --- a/tools/macho-dump/macho-dump.cpp +++ b/tools/macho-dump/macho-dump.cpp @@ -310,6 +310,29 @@ static int DumpDysymtabCommand(MachOObject &Obj, return Res; } +static int DumpLinkeditDataCommand(MachOObject &Obj, + const MachOObject::LoadCommandInfo &LCI) { + InMemoryStruct<macho::LinkeditDataLoadCommand> LLC; + Obj.ReadLinkeditDataLoadCommand(LCI, LLC); + if (!LLC) + return Error("unable to read segment load command"); + + outs() << " ('dataoff', " << LLC->DataOffset << ")\n" + << " ('datasize', " << LLC->DataSize << ")\n" + << " ('_addresses', [\n"; + + SmallVector<uint64_t, 8> Addresses; + Obj.ReadULEB128s(LLC->DataOffset, Addresses); + for (unsigned i = 0, e = Addresses.size(); i != e; ++i) + outs() << " # Address " << i << '\n' + << " ('address', " << format("0x%x", Addresses[i]) << "),\n"; + + outs() << " ])\n"; + + return 0; +} + + static int DumpLoadCommand(MachOObject &Obj, unsigned Index) { const MachOObject::LoadCommandInfo &LCI = Obj.getLoadCommandInfo(Index); int Res = 0; @@ -330,6 +353,11 @@ static int DumpLoadCommand(MachOObject &Obj, unsigned Index) { case macho::LCT_Dysymtab: Res = DumpDysymtabCommand(Obj, LCI); break; + case macho::LCT_CodeSignature: + case macho::LCT_SegmentSplitInfo: + case macho::LCT_FunctionStarts: + Res = DumpLinkeditDataCommand(Obj, LCI); + break; default: Warning("unknown load command: " + Twine(LCI.Command.Type)); break; |