Skip to content

Commit 1b95230

Browse files
HackderCensoredUsername
authored andcommitted
fix(aarch64): shift immhi bits of adrp to account for immlo
the immlo bits of the ADRP instruction on aarch64 must be shifted by 2, as the bottom two bits are stored in the immhi field. Similarly to how ADR works.
1 parent a294fba commit 1b95230

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

plugin/src/arch/aarch64/compiler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ pub(super) fn compile_instruction(ctx: &mut Context, data: MatchData) -> Result<
535535
let mask = bitmask(bits);
536536
let half = -1i32 << (bits - 1);
537537
if let Some((_, scaled)) = static_range_check(value, half, mask, 12)? {
538-
statics.push((5, scaled & 0x7FFFF));
538+
statics.push((5, (scaled >> 2u8) & 0x7FFFFu32));
539539
statics.push((29, scaled & 3));
540540

541541
} else {

0 commit comments

Comments
 (0)