mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Fixing problems with X86_64_32 relocations and making the assertions more readable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160889 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -208,10 +208,9 @@ void RuntimeDyldELF::resolveX86_64Relocation(uint8_t *LocalAddress,
|
|||||||
case ELF::R_X86_64_32:
|
case ELF::R_X86_64_32:
|
||||||
case ELF::R_X86_64_32S: {
|
case ELF::R_X86_64_32S: {
|
||||||
Value += Addend;
|
Value += Addend;
|
||||||
// FIXME: Handle the possibility of this assertion failing
|
assert((Type == ELF::R_X86_64_32 && (Value <= UINT32_MAX)) ||
|
||||||
assert((Type == ELF::R_X86_64_32 && !(Value & 0xFFFFFFFF00000000ULL)) ||
|
(Type == ELF::R_X86_64_32S &&
|
||||||
(Type == ELF::R_X86_64_32S &&
|
((int64_t)Value <= INT32_MAX && (int64_t)Value >= INT32_MIN)));
|
||||||
(Value & 0xFFFFFFFF00000000ULL) == 0xFFFFFFFF00000000ULL));
|
|
||||||
uint32_t TruncatedAddr = (Value & 0xFFFFFFFF);
|
uint32_t TruncatedAddr = (Value & 0xFFFFFFFF);
|
||||||
uint32_t *Target = reinterpret_cast<uint32_t*>(LocalAddress);
|
uint32_t *Target = reinterpret_cast<uint32_t*>(LocalAddress);
|
||||||
*Target = TruncatedAddr;
|
*Target = TruncatedAddr;
|
||||||
@ -220,7 +219,7 @@ void RuntimeDyldELF::resolveX86_64Relocation(uint8_t *LocalAddress,
|
|||||||
case ELF::R_X86_64_PC32: {
|
case ELF::R_X86_64_PC32: {
|
||||||
uint32_t *Placeholder = reinterpret_cast<uint32_t*>(LocalAddress);
|
uint32_t *Placeholder = reinterpret_cast<uint32_t*>(LocalAddress);
|
||||||
int64_t RealOffset = *Placeholder + Value + Addend - FinalAddress;
|
int64_t RealOffset = *Placeholder + Value + Addend - FinalAddress;
|
||||||
assert(RealOffset <= 214783647 && RealOffset >= -214783648);
|
assert(RealOffset <= INT32_MAX && RealOffset >= INT32_MIN);
|
||||||
int32_t TruncOffset = (RealOffset & 0xFFFFFFFF);
|
int32_t TruncOffset = (RealOffset & 0xFFFFFFFF);
|
||||||
*Placeholder = TruncOffset;
|
*Placeholder = TruncOffset;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user