From 4c55e0db0f0a095dcd76326bef24d0fe05d2a5e4 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 27 Nov 2010 13:26:12 +0000 Subject: macho-dump: Add support for dumping dysymtab indirect symbol table. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120214 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/macho-dump/macho-dump.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/macho-dump/macho-dump.cpp b/tools/macho-dump/macho-dump.cpp index 9648caec55..487a00607b 100644 --- a/tools/macho-dump/macho-dump.cpp +++ b/tools/macho-dump/macho-dump.cpp @@ -14,6 +14,7 @@ #include "llvm/Object/MachOObject.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Format.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" @@ -154,7 +155,24 @@ static int DumpDysymtabCommand(MachOObject &Obj, outs() << " ('locreloff', " << DLC->LocalRelocationTableOffset << ")\n"; outs() << " ('nlocrel', " << DLC->NumLocalRelocationTableEntries << ")\n"; - return 0; + // Dump the indirect symbol table. + int Res = 0; + outs() << " ('_indirect_symbols', [\n"; + for (unsigned i = 0; i != DLC->NumIndirectSymbolTableEntries; ++i) { + InMemoryStruct ISTE; + Obj.ReadIndirectSymbolTableEntry(*DLC, i, ISTE); + if (!ISTE) { + Res = Error("unable to read segment load command"); + break; + } + + outs() << " # Indirect Symbol " << i << "\n"; + outs() << " (('symbol_index', " + << format("%#x", ISTE->Index) << "),),\n"; + } + outs() << " ])\n"; + + return Res; } static int DumpLoadCommand(MachOObject &Obj, unsigned Index) { -- cgit v1.2.3