summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-03-21 07:26:41 +0000
committerJuergen Ributzka <juergen@apple.com>2014-03-21 07:26:41 +0000
commit4923eea4f6a5c547cfa87e2da7ba788100df4982 (patch)
tree02263154642555f0e803f9aaf1186b36f24a8018 /lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
parentfc029f2983a69de3ccca576f2cee23292d1b04ef (diff)
downloadllvm-4923eea4f6a5c547cfa87e2da7ba788100df4982.tar.gz
llvm-4923eea4f6a5c547cfa87e2da7ba788100df4982.tar.bz2
llvm-4923eea4f6a5c547cfa87e2da7ba788100df4982.tar.xz
[RuntimeDyld] Allow processRelocationRef to process more than one relocation entry at a time.
Some targets require more than one relocation entry to perform a relocation. This change allows processRelocationRef to process more than one relocation entry at a time by passing the relocation iterator itself instead of just the relocation entry. Related to <rdar://problem/16199095> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp')
-rw-r--r--lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
index 62de7b707c..0f9fc9169d 100644
--- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
+++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
@@ -320,15 +320,17 @@ bool RuntimeDyldMachO::resolveARMRelocation(uint8_t *LocalAddress,
return false;
}
-void RuntimeDyldMachO::processRelocationRef(unsigned SectionID,
- RelocationRef RelI,
- ObjectImage &Obj,
- ObjSectionToIDMap &ObjSectionToID,
- const SymbolTableMap &Symbols,
- StubMap &Stubs) {
+relocation_iterator
+RuntimeDyldMachO::processRelocationRef(unsigned SectionID,
+ relocation_iterator RelI,
+ ObjectImage &Obj,
+ ObjSectionToIDMap &ObjSectionToID,
+ const SymbolTableMap &Symbols,
+ StubMap &Stubs) {
const ObjectFile *OF = Obj.getObjectFile();
const MachOObjectFile *MachO = static_cast<const MachOObjectFile*>(OF);
- MachO::any_relocation_info RE= MachO->getRelocation(RelI.getRawDataRefImpl());
+ MachO::any_relocation_info RE =
+ MachO->getRelocation(RelI->getRawDataRefImpl());
uint32_t RelType = MachO->getAnyRelocationType(RE);
@@ -339,7 +341,7 @@ void RuntimeDyldMachO::processRelocationRef(unsigned SectionID,
// Note: This will fail horribly where the relocations *do* need to be
// applied, but that was already the case.
if (MachO->isRelocationScattered(RE))
- return;
+ return ++RelI;
RelocationValueRef Value;
SectionEntry &Section = Sections[SectionID];
@@ -348,7 +350,7 @@ void RuntimeDyldMachO::processRelocationRef(unsigned SectionID,
bool IsPCRel = MachO->getAnyRelocationPCRel(RE);
unsigned Size = MachO->getAnyRelocationLength(RE);
uint64_t Offset;
- RelI.getOffset(Offset);
+ RelI->getOffset(Offset);
uint8_t *LocalAddress = Section.Address + Offset;
unsigned NumBytes = 1 << Size;
uint64_t Addend = 0;
@@ -356,7 +358,7 @@ void RuntimeDyldMachO::processRelocationRef(unsigned SectionID,
if (isExtern) {
// Obtain the symbol name which is referenced in the relocation
- symbol_iterator Symbol = RelI.getSymbol();
+ symbol_iterator Symbol = RelI->getSymbol();
StringRef TargetName;
Symbol->getName(TargetName);
// First search for the symbol in the local symbol table
@@ -443,6 +445,7 @@ void RuntimeDyldMachO::processRelocationRef(unsigned SectionID,
else
addRelocationForSection(RE, Value.SectionID);
}
+ return ++RelI;
}