summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/RuntimeDyld
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-07-22 21:42:49 +0000
committerJuergen Ributzka <juergen@apple.com>2014-07-22 21:42:49 +0000
commitdd19d33057e634035a4ae10fa46395d1e4dce346 (patch)
tree5a924fcfb6d0e5b447c4432241ff8f49a41aec8e /llvm/lib/ExecutionEngine/RuntimeDyld
parent175b78b02e99b9d9d1299e0ab1fee9ef689f7ce7 (diff)
downloadbcm5719-llvm-dd19d33057e634035a4ae10fa46395d1e4dce346.tar.gz
bcm5719-llvm-dd19d33057e634035a4ae10fa46395d1e4dce346.zip
[RuntimeDyld][MachO][AArch64] Add assertion to check for duplicate addend definition.
In MachO for AArch64 it is possible to have an explicit addend defined by the ARM64_RELOC_ADDEND relocation or having an addend encoded within the instruction. Only one of them are allowed per relocation. llvm-svn: 213687
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
index 775ed9ec363..d961606f0a3 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOAArch64.h
@@ -41,16 +41,14 @@ public:
// addend for the following relocation. If found: (1) store the associated
// addend, (2) consume the next relocation, and (3) use the stored addend to
// override the addend.
- bool HasExplicitAddend = false;
int64_t ExplicitAddend = 0;
if (Obj.getAnyRelocationType(RelInfo) == MachO::ARM64_RELOC_ADDEND) {
assert(!Obj.getPlainRelocationExternal(RelInfo));
assert(!Obj.getAnyRelocationPCRel(RelInfo));
assert(Obj.getAnyRelocationLength(RelInfo) == 2);
- HasExplicitAddend = true;
int64_t RawAddend = Obj.getPlainRelocationSymbolNum(RelInfo);
// Sign-extend the 24-bit to 64-bit.
- ExplicitAddend = (RawAddend << 40) >> 40;
+ ExplicitAddend = SignExtend64(RawAddend, 24);
++RelI;
RelInfo = Obj.getRelocation(RelI->getRawDataRefImpl());
}
@@ -59,7 +57,9 @@ public:
RelocationValueRef Value(
getRelocationValueRef(ObjImg, RelI, RE, ObjSectionToID, Symbols));
- if (HasExplicitAddend) {
+ assert((ExplicitAddend == 0 || RE.Addend == 0) && "Relocation has "\
+ "ARM64_RELOC_ADDEND and embedded addend in the instruction.");
+ if (ExplicitAddend) {
RE.Addend = ExplicitAddend;
Value.Addend = ExplicitAddend;
}
OpenPOWER on IntegriCloud