mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-06 12:16:22 +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
The codegen
crate contains the code to convert from MIR into LLVM IR,
and then from LLVM IR into machine code. In general it contains code
that runs towards the end of the compilation process.
For more information about how codegen works, see the rustc dev guide.