Skip to content

Packed&aligned structs? #73988

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leonardo-m opened this issue Jul 3, 2020 · 1 comment
Closed

Packed&aligned structs? #73988

leonardo-m opened this issue Jul 3, 2020 · 1 comment
Labels
A-layout Area: Memory layout of types C-feature-request Category: A feature request, i.e: not implemented / a PR.

Comments

@leonardo-m
Copy link

Here they explain the need for repr(C) structs that are both aligned and packed:
https://immunant.com/blog/2020/06/kernel_modules/

Their solution:

#[repr(C, align(64))]
pub struct xregs_state(pub xregs_state_Inner);
#[repr(C, packed)]
pub struct xregs_state_Inner {
  // ...
}

Perhaps it's worth supporting this directly.

@jonas-schievink jonas-schievink added A-layout Area: Memory layout of types C-feature-request Category: A feature request, i.e: not implemented / a PR. labels Jul 3, 2020
@RalfJung
Copy link
Member

Closing as duplicate of #59154

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-layout Area: Memory layout of types C-feature-request Category: A feature request, i.e: not implemented / a PR.
Projects
None yet
Development

No branches or pull requests

3 participants