git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214204
91177308-0d34-0410-b5e6-
96231b3b80d8
namespace llvm {
int64_t RuntimeDyldMachO::decodeAddend(uint8_t *LocalAddress, unsigned NumBytes,
namespace llvm {
int64_t RuntimeDyldMachO::decodeAddend(uint8_t *LocalAddress, unsigned NumBytes,
- uint32_t RelType) const {
+ MachO::RelocationInfoType) const {
int64_t Addend = 0;
memcpy(&Addend, LocalAddress, NumBytes);
return Addend;
int64_t Addend = 0;
memcpy(&Addend, LocalAddress, NumBytes);
return Addend;
/// Extract the addend encoded in the instruction.
int64_t decodeAddend(uint8_t *LocalAddress, unsigned NumBytes,
/// Extract the addend encoded in the instruction.
int64_t decodeAddend(uint8_t *LocalAddress, unsigned NumBytes,
- uint32_t RelType) const;
+ MachO::RelocationInfoType RelType) const;
/// Construct a RelocationValueRef representing the relocation target.
/// For Symbols in known sections, this will return a RelocationValueRef
/// Construct a RelocationValueRef representing the relocation target.
/// For Symbols in known sections, this will return a RelocationValueRef
RI->getOffset(Offset);
uint8_t *LocalAddress = Section.Address + Offset;
unsigned NumBytes = 1 << Size;
RI->getOffset(Offset);
uint8_t *LocalAddress = Section.Address + Offset;
unsigned NumBytes = 1 << Size;
- uint32_t RelType = Obj.getAnyRelocationType(RelInfo);
+ MachO::RelocationInfoType RelType =
+ static_cast<MachO::RelocationInfoType>(Obj.getAnyRelocationType(RelInfo));
int64_t Addend = impl().decodeAddend(LocalAddress, NumBytes, RelType);
return RelocationEntry(SectionID, Offset, RelType, Addend, IsPCRel, Size);
int64_t Addend = impl().decodeAddend(LocalAddress, NumBytes, RelType);
return RelocationEntry(SectionID, Offset, RelType, Addend, IsPCRel, Size);
/// Extract the addend encoded in the instruction / memory location.
int64_t decodeAddend(uint8_t *LocalAddress, unsigned NumBytes,
/// Extract the addend encoded in the instruction / memory location.
int64_t decodeAddend(uint8_t *LocalAddress, unsigned NumBytes,
- uint32_t RelType) const {
+ MachO::RelocationInfoType RelType) const {
int64_t Addend = 0;
// Verify that the relocation has the correct size and alignment.
switch (RelType) {
int64_t Addend = 0;
// Verify that the relocation has the correct size and alignment.
switch (RelType) {
}
/// Extract the addend encoded in the instruction.
}
/// Extract the addend encoded in the instruction.
- void encodeAddend(uint8_t *LocalAddress, uint32_t RelType,
+ void encodeAddend(uint8_t *LocalAddress, MachO::RelocationInfoType RelType,
int64_t Addend) const {
// Verify that the relocation has the correct alignment.
switch (RelType) {
int64_t Addend) const {
// Verify that the relocation has the correct alignment.
switch (RelType) {
const SectionEntry &Section = Sections[RE.SectionID];
uint8_t *LocalAddress = Section.Address + RE.Offset;
const SectionEntry &Section = Sections[RE.SectionID];
uint8_t *LocalAddress = Section.Address + RE.Offset;
+ MachO::RelocationInfoType RelType =
+ static_cast<MachO::RelocationInfoType>(RE.RelType);
default:
llvm_unreachable("Invalid relocation type!");
case MachO::ARM64_RELOC_UNSIGNED: {
default:
llvm_unreachable("Invalid relocation type!");
case MachO::ARM64_RELOC_UNSIGNED: {
// Check if branch is in range.
uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
int64_t PCRelVal = Value - FinalAddress + RE.Addend;
// Check if branch is in range.
uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
int64_t PCRelVal = Value - FinalAddress + RE.Addend;
- encodeAddend(LocalAddress, RE.RelType, PCRelVal);
+ encodeAddend(LocalAddress, RelType, PCRelVal);
break;
}
case MachO::ARM64_RELOC_GOT_LOAD_PAGE21:
break;
}
case MachO::ARM64_RELOC_GOT_LOAD_PAGE21:
uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
int64_t PCRelVal =
((Value + RE.Addend) & (-4096)) - (FinalAddress & (-4096));
uint64_t FinalAddress = Section.LoadAddress + RE.Offset;
int64_t PCRelVal =
((Value + RE.Addend) & (-4096)) - (FinalAddress & (-4096));
- encodeAddend(LocalAddress, RE.RelType, PCRelVal);
+ encodeAddend(LocalAddress, RelType, PCRelVal);
break;
}
case MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12:
break;
}
case MachO::ARM64_RELOC_GOT_LOAD_PAGEOFF12:
Value += RE.Addend;
// Mask out the page address and only use the lower 12 bits.
Value &= 0xFFF;
Value += RE.Addend;
// Mask out the page address and only use the lower 12 bits.
Value &= 0xFFF;
- encodeAddend(LocalAddress, RE.RelType, Value);
+ encodeAddend(LocalAddress, RelType, Value);
break;
}
case MachO::ARM64_RELOC_SUBTRACTOR:
break;
}
case MachO::ARM64_RELOC_SUBTRACTOR: