summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>2020-09-18 22:25:01 +0200
committerMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>2020-09-18 22:25:01 +0200
commit60567cfb44249250ce3f86b8131a07b37c7ef55b (patch)
tree6ac4a7898834c0803c54f1e34dc0ddc12fffc5bc
parentc3f1cedbf23a467c34cd699eeb3a7734f5a89af9 (diff)
Ignore the alignment requirement on `kernel_param`
Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
-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 {{