/// Return size of this relocation.
size_t getSize() const { return getSizeForType(Type); }
- /// Handle special cases when relocation should not be processed by bolt
+ /// Skip relocations that we don't want to handle in BOLT
+ static bool skipRelocationType(uint64_t Type);
+
+ /// Handle special cases when relocation should not be processed by BOLT
static bool skipRelocationProcess(uint64_t Type, uint64_t Contents);
// Adjust value depending on relocation type (make it PC relative or not)
}
}
+bool skipRelocationTypeX86(uint64_t Type) { return Type == ELF::R_X86_64_NONE; }
+
+bool skipRelocationTypeAArch64(uint64_t Type) {
+ return Type == ELF::R_AARCH64_NONE || Type == ELF::R_AARCH64_LD_PREL_LO19;
+}
+
bool skipRelocationProcessX86(uint64_t Type, uint64_t Contents) {
return false;
}
return getSizeForTypeX86(Type);
}
+bool Relocation::skipRelocationType(uint64_t Type) {
+ if (Arch == Triple::aarch64)
+ return skipRelocationTypeAArch64(Type);
+ return skipRelocationTypeX86(Type);
+}
+
bool Relocation::skipRelocationProcess(uint64_t Type, uint64_t Contents) {
if (Arch == Triple::aarch64)
return skipRelocationProcessAArch64(Type, Contents);
SmallString<16> TypeName;
Rel.getTypeName(TypeName);
uint64_t RType = Rel.getType();
- if (Relocation::isNone(RType))
+ if (Relocation::skipRelocationType(RType))
continue;
// Adjust the relocation type as the linker might have skewed it.