Skip to content

Commit 7dbc568

Browse files
committed
Fix va_args calling on aarch64 non-macos/ios.
emit_aapcs_va_arg() emits hardcoded field indexes to access the aarch64-specific `VaListImpl` struct. Due to the removed padding those indexes have changed.
1 parent 4a8202c commit 7dbc568

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

compiler/rustc_codegen_llvm/src/va_arg.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ fn emit_aapcs_va_arg(
110110

111111
let gr_type = target_ty.is_any_ptr() || target_ty.is_integral();
112112
let (reg_off, reg_top_index, slot_size) = if gr_type {
113-
let gr_offs = bx.struct_gep(va_list_ty, va_list_addr, 7);
113+
let gr_offs = bx.struct_gep(va_list_ty, va_list_addr, 3);
114114
let nreg = (layout.size.bytes() + 7) / 8;
115-
(gr_offs, 3, nreg * 8)
115+
(gr_offs, 1, nreg * 8)
116116
} else {
117-
let vr_off = bx.struct_gep(va_list_ty, va_list_addr, 9);
117+
let vr_off = bx.struct_gep(va_list_ty, va_list_addr, 4);
118118
let nreg = (layout.size.bytes() + 15) / 16;
119-
(vr_off, 5, nreg * 16)
119+
(vr_off, 2, nreg * 16)
120120
};
121121

122122
// if the offset >= 0 then the value will be on the stack

0 commit comments

Comments
 (0)