Repository navigation
TCB: compile the assembly only on little-endian targets with the ABI's pointer width #248
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
Changes from all commits
b87fbe5
01817b2
d059682
8ac58bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,18 +5,18 @@ | |
| //! whose machine code has been proven correct, memory safe and constant time | ||
| //! against its contract. | ||
|
|
||
| #[cfg(target_arch = "aarch64")] | ||
| #[cfg(all(target_arch = "aarch64", target_endian = "little", target_pointer_width = "64"))] | ||
| #[rustfmt::skip] | ||
| pub(crate) mod aarch64; | ||
|
|
||
| #[cfg(target_arch = "arm")] | ||
| #[cfg(all(target_arch = "arm", target_endian = "little"))] | ||
| #[rustfmt::skip] | ||
| pub(crate) mod arm; | ||
|
|
||
| #[cfg(target_arch = "x86")] | ||
| #[rustfmt::skip] | ||
| pub(crate) mod x86; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are too many checks -- it's only arm that has multiple endianesses, and I don't think target_pointer_width is ambigious anywhere at all...
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both conditions do exclude real targets. I checked each against
You're right that some conditions are redundant: x86 is always little-endian and 32-bit, arm is always 32-bit, and x86_64 is always little-endian. The emitted Generated by Claude Code
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi, this still needs action
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 8ac58bb: each target's
Generated by Claude Code |
||
|
|
||
| #[cfg(target_arch = "x86_64")] | ||
| #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] | ||
| #[rustfmt::skip] | ||
| pub(crate) mod x86_64; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wat, how you can have aarch64 that doesn't have target_poitner_width of 64???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rustc has three (all tier 3), from
rustc +nightly -Z unstable-options --print target-spec-json --target …:aarch64-unknown-linux-gnu_ilp32:"arch": "aarch64","target-pointer-width": 32aarch64_be-unknown-linux-gnu_ilp32: the same, big-endianarm64_32-apple-watchos:"arch": "aarch64","target-pointer-width": 32(Apple Watch)All three are AArch64 instructions with a 32-bit data model (ILP32). Pointers and
usizeare 32 bits in memory and inxregisters, whose upper halves the calling convention leaves unspecified. The AArch64 model and contracts assume 64-bitusizeand pointers, so without the width check the crate would compile for these targets against the wrong contracts.Generated by Claude Code