[PATCH 3/4] rust/bindgen_parameters: Mark s390 types as opaque to prevent repr conflicts

Jan Polensky posted 4 patches 2 months ago
There is a newer version of this series
[PATCH 3/4] rust/bindgen_parameters: Mark s390 types as opaque to prevent repr conflicts
Posted by Jan Polensky 2 months ago
Bindgen attempts to generate Rust layouts for a number of s390 structs
that are packed but contain, or transitively contain, aligned fields.
Rust rejects such layouts with E0588 ("packed type cannot transitively
contain a #[repr(align)] type").

Add the affected s390 types to the opaque type list so bindgen emits
opaque blob types instead of full representations. This matches existing
workarounds for x86 types such as alt_instr and x86_msi_data.

References: https://lore.kernel.org/all/e5c7aa10-590d-0d20-dd3b-385bee2377e7@intel.com/
Signed-off-by: Jan Polensky <japo@linux.ibm.com>
---
 rust/bindgen_parameters | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/rust/bindgen_parameters b/rust/bindgen_parameters
index 6f02d9720ad2..8402b0c93545 100644
--- a/rust/bindgen_parameters
+++ b/rust/bindgen_parameters
@@ -14,6 +14,13 @@
 --opaque-type alt_instr
 --opaque-type x86_msi_data
 --opaque-type x86_msi_addr_lo
+# s390-only: same packed/align issue as above (E0588).
+--opaque-type lowcore
+--opaque-type tod_clock
+--opaque-type tpi_info
+--opaque-type uv_cb.*
+--opaque-type uv_secret.*
+--opaque-type zpci_fib
 
 # If SMP is disabled, `arch_spinlock_t` is defined as a ZST which triggers a Rust
 # warning. We don't need to peek into it anyway.
-- 
2.51.0
Re: [PATCH 3/4] rust/bindgen_parameters: Mark s390 types as opaque to prevent repr conflicts
Posted by Gary Guo 2 months ago
On Tue May 12, 2026 at 11:59 AM BST, Jan Polensky wrote:
> Bindgen attempts to generate Rust layouts for a number of s390 structs
> that are packed but contain, or transitively contain, aligned fields.
> Rust rejects such layouts with E0588 ("packed type cannot transitively
> contain a #[repr(align)] type").
> 
> Add the affected s390 types to the opaque type list so bindgen emits
> opaque blob types instead of full representations. This matches existing
> workarounds for x86 types such as alt_instr and x86_msi_data.
> 
> References: https://lore.kernel.org/all/e5c7aa10-590d-0d20-dd3b-385bee2377e7@intel.com/
> Signed-off-by: Jan Polensky <japo@linux.ibm.com>

Reviewed-by: Gary Guo <gary@garyguo.net>

> ---
>  rust/bindgen_parameters | 7 +++++++
>  1 file changed, 7 insertions(+)