rust/compiler/rustc_codegen_llvm
Guillaume Gomez cf4fbc0695
Rollup merge of #141622 - folkertdev:powerpc-va_arg, r=workingjubilee
implement `va_arg` for `powerpc`

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

The llvm `va_arg` implementation is well-known to have serious limitations. Some planned changes to rust's `VaList` make it much more likely that LLVM miscompiles `va_arg`, so this PR adds support for the various powerpc targets. Now at least the targets that `core` has explicit support for will continue to work.

For `powerpc` (the 32-bit variant) this implementation also fixes a bug where only up to 20 variadic arguments were supported.

Locally (with qemu), these targets now pass the tests in https://github.com/rust-lang/rust/blob/master/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs. That test does not actually run for the powerpc targets in CI though.

The implementation is based on clang:

- handling of big endian architectures 3c8089d1ea/clang/lib/CodeGen/ABIInfoImpl.cpp (L191-L193)
- 64-bit 3c8089d1ea/clang/lib/CodeGen/Targets/PPC.cpp (L969)
- 32-bit 3c8089d1ea/clang/lib/CodeGen/Targets/PPC.cpp (L430)

cc `@daltenty` (target maintainer)
r? `@workingjubilee`
`@rustbot` label: +F-c_variadic
2025-06-01 19:35:42 +02:00
..
src Rollup merge of #141622 - folkertdev:powerpc-va_arg, r=workingjubilee 2025-06-01 19:35:42 +02:00
Cargo.toml don't depend on rustc_attr_parsing if rustc_data_structures will do 2025-05-09 23:16:55 +02:00
messages.ftl KCFI: Add KCFI arity indicator support 2025-04-05 04:05:04 +00:00
README.md mv compiler to compiler/ 2020-08-30 18:45:07 +03:00

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.