# Linux Kernel compiler argment parameter
Some example https://godbolt.org/z/KKzhe8n38
```
define dso_local noundef i32 @f()
local_unnamed_addr #0 {
ret i32 42
}
```
```
define dso_local void @f(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.S) align 4 %0)
local_unnamed_addr #0 {
store i32 42, ptr %0, align 4
ret void
}
```
----
### rustc PRs for compiler flags:
- https://github.com/rust-lang/rust/pull/116892/files
- https://github.com/rust-lang/rust/pull/105812
- https://github.com/rust-lang/rust/pull/124655
### Good feeture to have (macros)
#### completed by https://rust-lang.zulipchat.com/#narrow/stream/404510-wg-macros/topic/May.20we.20need.20a.20.60c_stringify!.60.20and.20.60c_concat!.60.20macros.3F
- https://lore.kernel.org/rust-for-linux/CANiq72nbbtNp4vGGHkXVSgSW+WU=5Z9uGRO_LLg7+ezTqrZ_tQ@mail.gmail.com
# Rust4Linux issue [#355](https://github.com/Rust-for-Linux/linux/issues/355)
### Support for `-Zregparm=3` and `-Zreg-struct-return`.
These are two different feature, one is for the `-Zregparm` and the other one if for the `-Zreg-struct-return`.
There was already some initial exploration from Miguel for `-Zregparm`, and the tracking issue is https://github.com/rust-lang/rust/issues/116972
## (`-mregparm=3`) Rustc issue #[116972](https://github.com/rust-lang/rust/issues/116972) exploration
Looks like that there is a reference to the linux kernel that is https://github.com/intel-lab-lkp/linux/commit/366c4bda8d5890a8f44ec23a07664e1d77c5cada where they are explain the problem and a use case for this parameter.
TL;DR: The equivalent of Clang's/GCC's `-mregparm=3`. The kernel needs it to support the x86 32-bit architecture, together with `-Zreg-struct-return`.
Clang reference implementation: https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CodeGenModule.cpp#L451
## Rustc issue #[116973](https://github.com/rust-lang/rust/issues/116973) exploration
Still need to be done.