mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-24 08:57:09 +00:00
implement `va_arg` for x86_64 systemv
tracking issue: https://github.com/rust-lang/rust/issues/44930
Turns out LLVM's `va_arg` is also unreliable for this target.
https://github.com/llvm/llvm-project/issues/141361
So, like clang, we implement our own. I used
- the spec at https://gitlab.com/x86-psABIs/x86-64-ABI
- the clang implementation at 9a440f8477/clang/lib/CodeGen/Targets/X86.cpp (L3041)
We can take a bunch of shortcuts because the return type of `va_list` must implement `VaArgSafe`. I also extended some of the tests, because up to 11 floats can be stored in the `reg_safe_area` for this calling convention.
r? `@workingjubilee`
`@rustbot` label +F-c_variadic
try-job: x86_64-apple-1