-
Notifications
You must be signed in to change notification settings - Fork 749
cpu: intel: correct assumptions for x32 abi #2518
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
base: main
Are you sure you want to change the base?
Conversation
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.
The last I heard, nobody is using the x32 ABI in practice. Do we really need to support it?
const _ASSUMED_POINTER_SIZE: usize = 8; | ||
#[cfg(target_arch = "x86")] | ||
#[cfg(any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "32")))] |
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.
These assertions are here because we don't know if our code works with the x32 ABI.
At a minimum, we'd also need to duplicate all the x86-64 coverage
tests in ci.yml for this new ABI, in addition to doing this.
This is because we're unsure whether all the assembly code correctly supports 32-bit size_t
and 32-bit pointers.
We do do maintain x32 port at PLD Linux, so does Debian so it would be nice if |
Either way, to support this target we'd need the coverage tests to be expanded to run for the x32 target too. I think that's the first step here. Especially, I am curious if GitHub Actions even supports an operating system that can run x32 binaries. You can try it out by copy/pasting all the x86_64-* stuff in the |
const _ASSUMED_POINTER_SIZE: usize = 8; | ||
#[cfg(target_arch = "x86")] | ||
#[cfg(any(target_arch = "x86", all(target_arch = "x86_64", target_pointer_width = "32")))] |
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.
I suggest we also require target_os = "linux" for x32 support. For example, we don't want to have to deal with the combination of Windows and x32 or FreeBSD and x32, etc.
I didn't look at the details of the x32 ABI. If the ABI is defined such that pointers and size_t values are passed in 64-registers, zero-extended, then it can work fine without changing the assembly. My understanding is that x32 does zero-extend pointers passed in registers. If it doesn't zero-extend size_t values passed in registers then we'd need to audit our assembly code to verify that it always assumes zeroes the high half of every size/length parameter declared as
I don't think it is a good strategy for take the generic code path for x32 ABI. One thing we could do is change the CPU feature detection logic so that for the x32 ABI, no CPU features are detected. This will limit the amount of assembly code that would be used for the x32 ABI. But we'd still need to review |
Fixes build for rust's Tier 2 platform
x86_64-unknown-linux-gnux32
(x32 ABI)