From 90e3e3a429e75a7d3671afcc30ed376b6186fd58 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 27 Nov 2010 13:39:48 +0000 Subject: macho-dump: Add support for dumping relocation entries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120216 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Object/MachOObject.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/Object/MachOObject.cpp') diff --git a/lib/Object/MachOObject.cpp b/lib/Object/MachOObject.cpp index 1e9ec70d42..f5bc73ada7 100644 --- a/lib/Object/MachOObject.cpp +++ b/lib/Object/MachOObject.cpp @@ -289,3 +289,16 @@ void MachOObject::ReadSection64(const LoadCommandInfo &LCI, Index * sizeof(macho::Section64)); ReadInMemoryStruct(*this, Buffer->getBuffer(), Offset, Res); } + +template<> +void SwapStruct(macho::RelocationEntry &Value) { + SwapValue(Value.Word0); + SwapValue(Value.Word1); +} +void MachOObject::ReadRelocationEntry(uint64_t RelocationTableOffset, + unsigned Index, + InMemoryStruct &Res) const { + uint64_t Offset = (RelocationTableOffset + + Index * sizeof(macho::RelocationEntry)); + ReadInMemoryStruct(*this, Buffer->getBuffer(), Offset, Res); +} -- cgit v1.2.3