summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2012-07-27 20:30:12 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2012-07-27 20:30:12 +0000
commit8e87a75be7ce004f55802e472a512df429729db1 (patch)
treea7389143d21834f19dcb3c96182027c7a9c6604e
parentbc65e8f94ef7f77a7fd4ab860e354ce9241f36f9 (diff)
downloadbcm5719-llvm-8e87a75be7ce004f55802e472a512df429729db1.tar.gz
bcm5719-llvm-8e87a75be7ce004f55802e472a512df429729db1.zip
Fixing problems with X86_64_32 relocations and making the assertions more readable.
llvm-svn: 160889
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index 01f6f91ed3e..75bb586ef2c 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -208,10 +208,9 @@ void RuntimeDyldELF::resolveX86_64Relocation(uint8_t *LocalAddress,
case ELF::R_X86_64_32:
case ELF::R_X86_64_32S: {
Value += Addend;
- // FIXME: Handle the possibility of this assertion failing
- assert((Type == ELF::R_X86_64_32 && !(Value & 0xFFFFFFFF00000000ULL)) ||
- (Type == ELF::R_X86_64_32S &&
- (Value & 0xFFFFFFFF00000000ULL) == 0xFFFFFFFF00000000ULL));
+ assert((Type == ELF::R_X86_64_32 && (Value <= UINT32_MAX)) ||
+ (Type == ELF::R_X86_64_32S &&
+ ((int64_t)Value <= INT32_MAX && (int64_t)Value >= INT32_MIN)));
uint32_t TruncatedAddr = (Value & 0xFFFFFFFF);
uint32_t *Target = reinterpret_cast<uint32_t*>(LocalAddress);
*Target = TruncatedAddr;
@@ -220,7 +219,7 @@ void RuntimeDyldELF::resolveX86_64Relocation(uint8_t *LocalAddress,
case ELF::R_X86_64_PC32: {
uint32_t *Placeholder = reinterpret_cast<uint32_t*>(LocalAddress);
int64_t RealOffset = *Placeholder + Value + Addend - FinalAddress;
- assert(RealOffset <= 214783647 && RealOffset >= -214783648);
+ assert(RealOffset <= INT32_MAX && RealOffset >= INT32_MIN);
int32_t TruncOffset = (RealOffset & 0xFFFFFFFF);
*Placeholder = TruncOffset;
break;
OpenPOWER on IntegriCloud