Skip to content

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

fix pulley LoadExtNameFar emitting wrong Reloc (#13858)

Firestar998ceb847ec341
diff --git a/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs b/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs
index 74bff5d97a..6d95eae50a 100644
--- a/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs
+++ b/cranelift/codegen/src/isa/pulley_shared/inst/emit.rs
@@ -152,18 +152,18 @@ fn pulley_emit<P>(
}
Inst::LoadExtNameFar { dst, name, offset } => {
- let size = match P::pointer_width() {
+ let (reloc, size) = match P::pointer_width() {
PointerWidth::PointerWidth32 => {
enc::xconst32(sink, dst, 0);
- 4
+ (Reloc::Abs4, 4)
}
PointerWidth::PointerWidth64 => {
enc::xconst64(sink, dst, 0);
- 8
+ (Reloc::Abs8, 8)
}
};
let end = sink.cur_offset();
- sink.add_reloc_at_offset(end - size, Reloc::Abs8, &**name, *offset);
+ sink.add_reloc_at_offset(end - size, reloc, &**name, *offset);
}
Inst::Call { info } => {