summaryrefslogtreecommitdiff
path: root/lib/Object/MachOObject.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-11-27 13:39:48 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-11-27 13:39:48 +0000
commit90e3e3a429e75a7d3671afcc30ed376b6186fd58 (patch)
tree1afdd3719869f2b6225fcba37425143de0961a30 /lib/Object/MachOObject.cpp
parent2acadbddf6783055249da9fc9ea40a05b83ce56a (diff)
downloadllvm-90e3e3a429e75a7d3671afcc30ed376b6186fd58.tar.gz
llvm-90e3e3a429e75a7d3671afcc30ed376b6186fd58.tar.bz2
llvm-90e3e3a429e75a7d3671afcc30ed376b6186fd58.tar.xz
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
Diffstat (limited to 'lib/Object/MachOObject.cpp')
-rw-r--r--lib/Object/MachOObject.cpp13
1 files changed, 13 insertions, 0 deletions
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<macho::RelocationEntry> &Res) const {
+ uint64_t Offset = (RelocationTableOffset +
+ Index * sizeof(macho::RelocationEntry));
+ ReadInMemoryStruct(*this, Buffer->getBuffer(), Offset, Res);
+}