Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Implement RiscvPCRelHi20 relocation in cranelift-object (#13226)

Tristan Rossf7c886b0072a
diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs
index c25369d902..c9bb0b3699 100644
--- a/cranelift/object/src/backend.rs
+++ b/cranelift/object/src/backend.rs
@@ -1030,6 +1030,16 @@ impl ObjectModule {
r_type: object::elf::R_RISCV_GOT_HI20,
}
}
+ Reloc::RiscvPCRelHi20 => {
+ assert_eq!(
+ self.object.format(),
+ object::BinaryFormat::Elf,
+ "RiscvPCRelHi20 is not supported for this file format"
+ );
+ RelocationFlags::Elf {
+ r_type: object::elf::R_RISCV_PCREL_HI20,
+ }
+ }
// FIXME
reloc => unimplemented!("{:?}", reloc),
};