Skip to content

Commit 33eb1cb

Browse files
committed
[cc] aarch64: more fixes
1 parent 4d6c9b9 commit 33eb1cb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cc/arch/aarch64/codegen.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,11 @@ impl Aarch64CodeGen {
9696
// Locals are at offsets from (frame_size - reg_save_area_size)
9797
(frame_size - self.reg_save_area_size) + offset
9898
} else {
99-
// Positive offset (arguments passed on stack) - use as-is
100-
offset
99+
// Positive offset = stack args (passed by caller)
100+
// regalloc uses 16 as base (x86_64 convention: saved rbp + return addr)
101+
// but aarch64 places stack args at [x29 + frame_size + slot_offset]
102+
// where slot_offset = offset - 16
103+
frame_size + offset - 16
101104
}
102105
}
103106

0 commit comments

Comments
 (0)