diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 08:33:44 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-11-27 08:33:44 +0000 |
commit | 33dab2a6eeb9ba42b1cfcdd71ec64f4455be861f (patch) | |
tree | 42321e7c3606b75daf85c05a95288a7a3ea488f8 /llvm/lib/Object/MachOObject.cpp | |
parent | a8070e02845f549083a7cdad64c054a228d7f26a (diff) | |
download | bcm5719-llvm-33dab2a6eeb9ba42b1cfcdd71ec64f4455be861f.tar.gz bcm5719-llvm-33dab2a6eeb9ba42b1cfcdd71ec64f4455be861f.zip |
macho-dump: Add support for dumping symtab and dysymtab commands.
llvm-svn: 120204
Diffstat (limited to 'llvm/lib/Object/MachOObject.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObject.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/lib/Object/MachOObject.cpp b/llvm/lib/Object/MachOObject.cpp index ce817d6cac2..1e15f296e0f 100644 --- a/llvm/lib/Object/MachOObject.cpp +++ b/llvm/lib/Object/MachOObject.cpp @@ -188,3 +188,45 @@ void MachOObject::ReadSegment64LoadCommand(const LoadCommandInfo &LCI, InMemoryStruct<macho::Segment64LoadCommand> &Res) const { ReadInMemoryStruct(*this, Buffer->getBuffer(), LCI.Offset, Res); } + +template<> +static void SwapStruct(macho::SymtabLoadCommand &Value) { + SwapValue(Value.Type); + SwapValue(Value.Size); + SwapValue(Value.SymbolTableOffset); + SwapValue(Value.NumSymbolTableEntries); + SwapValue(Value.StringTableOffset); + SwapValue(Value.StringTableSize); +} +void MachOObject::ReadSymtabLoadCommand(const LoadCommandInfo &LCI, + InMemoryStruct<macho::SymtabLoadCommand> &Res) const { + ReadInMemoryStruct(*this, Buffer->getBuffer(), LCI.Offset, Res); +} + +template<> +static void SwapStruct(macho::DysymtabLoadCommand &Value) { + SwapValue(Value.Type); + SwapValue(Value.Size); + SwapValue(Value.LocalSymbolIndex); + SwapValue(Value.NumLocalSymbols); + SwapValue(Value.ExternalSymbolsIndex); + SwapValue(Value.NumExternalSymbols); + SwapValue(Value.UndefinedSymbolsIndex); + SwapValue(Value.NumUndefinedSymbols); + SwapValue(Value.TOCOffset); + SwapValue(Value.NumTOCEntries); + SwapValue(Value.ModuleTableOffset); + SwapValue(Value.NumModuleTableEntries); + SwapValue(Value.ReferenceSymbolTableOffset); + SwapValue(Value.NumReferencedSymbolTableEntries); + SwapValue(Value.IndirectSymbolTableOffset); + SwapValue(Value.NumIndirectSymbolTableEntries); + SwapValue(Value.ExternalRelocationTableOffset); + SwapValue(Value.NumExternalRelocationTableEntries); + SwapValue(Value.LocalRelocationTableOffset); + SwapValue(Value.NumLocalRelocationTableEntries); +} +void MachOObject::ReadDysymtabLoadCommand(const LoadCommandInfo &LCI, + InMemoryStruct<macho::DysymtabLoadCommand> &Res) const { + ReadInMemoryStruct(*this, Buffer->getBuffer(), LCI.Offset, Res); +} |