Skip to content
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

Regenerate mach bindings #314

Merged
merged 2 commits into from
Jun 23, 2023
Merged

Conversation

mukilan
Copy link
Member

@mukilan mukilan commented Jun 22, 2023

The current 'mach_sys.rs' was generated before rust-bindgen started translating '#pragma pack(n)' directives into #[repr(C, packed(n)] attributes on the rust struct defintions. These missing attributes cause debug assertions to fail because of misaligned access to the fields when serializing and deserializing the structs for mach_msg calls (see #312 and this discussion).

This PR regenerates the 'mach_sys.rs' file using the latest bindgen and mach headers from XCode MacOS SDK. It also introduces padding before the 'data size' field for messages with inline data so that they begin at 8-byte aligned addresses as required by rustc.

The second commit also fixes warnings emitted by latest rustc about drop() calls used on Copy types and drop() calls where a reference is passed instead of value.

The current 'mach_sys.rs' was generated before rust-bindgen
started translating '#pragma pack(n)' directives into
'#[repr(C, packed(n)]' attributes on the rust struct defintions.
These missing attributes cause debug assertions to fail
because of misaligned access to the fields when serializing
and deserializing the structs for mach_msg calls (see servo#312).

This PR regenerates the 'mach_sys.rs' file using the
latest bindgen and mach headers from XCode MacOS SDK.
It also introduces padding *before* the 'data size' field
for messages with inline data so that they begin at
8-byte aligned addresses as required by rustc.

Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
Latest rustc warns about drop() calls used on Copy types
and drop() calls where a reference is passed instead of value.

Signed-off-by: Mukilan Thiyagarajan <me@mukilan.in>
Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@mukilan mukilan merged commit 47c8263 into servo:master Jun 23, 2023
6 of 12 checks passed
mstange added a commit to mstange/samply that referenced this pull request Jan 25, 2024
This is a port of servo/ipc-channel#314 , originally
written by Mukilan Thiyagarajan <me@mukilan.in> .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants