summaryrefslogtreecommitdiffstats
path: root/rust/module/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/module/src/lib.rs')
-rw-r--r--rust/module/src/lib.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/rust/module/src/lib.rs b/rust/module/src/lib.rs
index bb15188a6abb..82dac6780b9c 100644
--- a/rust/module/src/lib.rs
+++ b/rust/module/src/lib.rs
@@ -219,9 +219,14 @@ pub fn module(ts: TokenStream) -> TokenStream {
const {param_name}: __{name}_{param_name} = __{name}_{param_name};
- // FIXME: does the `align` do the right thing here?
- // `core::mem::size_of(usize)`
- #[repr(C,align(8))]
+ // Note: the C macro that generates the static structs for the `__param` section
+ // asks for them to be `aligned(sizeof(void *))`. However, that was put in place
+ // in 2003 in commit 38d5b085d2 (\"[PATCH] Fix over-alignment problem on x86-64\")
+ // to undo GCC over-alignment of static structs of >32 bytes. It seems that is
+ // not the case anymore, so we simplify to a transparent representation here
+ // in the expectation that it is not needed anymore.
+ // TODO: revisit this to confirm the above comment and remove it if it happened
+ #[repr(transparent)]
struct __{name}_{param_name}_RacyKernelParam(kernel::bindings::kernel_param);
unsafe impl Sync for __{name}_{param_name}_RacyKernelParam {{