Skip to content

Commit 1b6f147

Browse files
committed
Respect addend for Arm64Call relocs
1 parent fb420fd commit 1b6f147

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cranelift/jit/src/compiled_blob.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,12 @@ impl CompiledBlob {
140140
}
141141
Reloc::Arm64Call => {
142142
let base = get_address(name);
143+
let what = unsafe { base.offset(isize::try_from(addend).unwrap()) };
143144
// The instruction is 32 bits long.
144145
let iptr = at as *mut u32;
145146
// The offset encoded in the `bl` instruction is the
146147
// number of bytes divided by 4.
147-
let diff = ((base as isize) - (at as isize)) >> 2;
148+
let diff = ((what as isize) - (at as isize)) >> 2;
148149
// Sign propagating right shift disposes of the
149150
// included bits, so the result is expected to be
150151
// either all sign bits or 0, depending on if the original

0 commit comments

Comments
 (0)