sym->st_value = static_cast<addr_type>(Addr);
}
-class LoadedELFObjectInfo : public RuntimeDyld::LoadedObjectInfo {
+class LoadedELFObjectInfo
+ : public RuntimeDyld::LoadedObjectInfoHelper<LoadedELFObjectInfo> {
public:
LoadedELFObjectInfo(RuntimeDyldImpl &RTDyld, unsigned BeginIdx,
unsigned EndIdx)
- : RuntimeDyld::LoadedObjectInfo(RTDyld, BeginIdx, EndIdx) {}
+ : LoadedObjectInfoHelper(RTDyld, BeginIdx, EndIdx) {}
OwningBinary<ObjectFile>
getObjectForDebug(const ObjectFile &Obj) const override;
case ELF::R_X86_64_PC32: {
uint64_t FinalAddress = Section.LoadAddress + Offset;
int64_t RealOffset = Value + Addend - FinalAddress;
- assert(RealOffset <= INT32_MAX && RealOffset >= INT32_MIN);
+ assert(isInt<32>(RealOffset));
int32_t TruncOffset = (RealOffset & 0xFFFFFFFF);
support::ulittle32_t::ref(Section.Address + Offset) = TruncOffset;
break;
uint64_t BranchImm = Value + Addend - FinalAddress;
// "Check that -2^27 <= result < 2^27".
- assert(-(1LL << 27) <= static_cast<int64_t>(BranchImm) &&
- static_cast<int64_t>(BranchImm) < (1LL << 27));
+ assert(isInt<28>(BranchImm));
// AArch64 code is emitted with .rela relocations. The data already in any
// bits affected by the relocation on entry is garbage.
((Value + Addend) & ~0xfffULL) - (FinalAddress & ~0xfffULL);
// Check that -2^32 <= X < 2^32
- assert(static_cast<int64_t>(Result) >= (-1LL << 32) &&
- static_cast<int64_t>(Result) < (1LL << 32) &&
- "overflow check failed for relocation");
+ assert(isInt<33>(Result) && "overflow check failed for relocation");
// AArch64 code is emitted with .rela relocations. The data already in any
// bits affected by the relocation on entry is garbage.
else if (Type == ELF::R_ARM_MOVT_ABS)
Value = (Value >> 16) & 0xFFFF;
*TargetPtr &= ~0x000F0FFF;
- *TargetPtr = Value & 0xFFF;
+ *TargetPtr |= Value & 0xFFF;
*TargetPtr |= ((Value >> 12) & 0xF) << 16;
break;
// Write 24 bit relative value to the branch instruction.
Value.Addend += ((*Placeholder) & 0x0000ffff) << 16;
else if (RelType == ELF::R_MIPS_LO16)
Value.Addend += ((*Placeholder) & 0x0000ffff);
+ else if (RelType == ELF::R_MIPS_32)
+ Value.Addend += *Placeholder;
processSimpleRelocation(SectionID, Offset, RelType, Value);
}
} else if (Arch == Triple::ppc64 || Arch == Triple::ppc64le) {