Rollup merge of #152594 - folkertdev:va-list-wasm64, r=alexcrichton

c-variadic: implement `va_arg` for `wasm64`

tracking issue: https://github.com/rust-lang/rust/issues/44930

A LLVM maintainer of the wasm backend confirmed that the behavior on wasm64 is intented: the slot size is 4 on both wasm32 and wasm64. https://github.com/llvm/llvm-project/pull/173580#issuecomment-3900118960

r? workingjubilee
cc @alexcrichton as target maintainer
This commit is contained in:
Jacob Pratt 2026-02-13 22:26:34 -05:00 committed by GitHub
commit 61dee57441
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1122,7 +1122,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
AllowHigherAlign::Yes,
ForceRightAdjust::No,
),
Arch::Wasm32 => emit_ptr_va_arg(
Arch::Wasm32 | Arch::Wasm64 => emit_ptr_va_arg(
bx,
addr,
target_ty,
@ -1135,7 +1135,6 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
AllowHigherAlign::Yes,
ForceRightAdjust::No,
),
Arch::Wasm64 => bug!("c-variadic functions are not fully implemented for wasm64"),
Arch::CSky => emit_ptr_va_arg(
bx,
addr,