-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Explicitly choose x86 softfloat/hardfloat ABI #136146
base: master
Are you sure you want to change the base?
Conversation
These commits modify compiler targets. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
r? compiler |
bd35e7c
to
89fa12a
Compare
("soft-float", Stability::Forbidden { reason: "unsound because it changes float ABI" }, &[]), | ||
// This cannot actually be toggled, the ABI always fixes it, so it'd make little sense to | ||
// stabilize. It must be in this list for the ABI check to be able to use it. | ||
("soft-float", Stability::Unstable(sym::x87_target_feature), &[]), |
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.
Making this "forbidden" just leads to duplicate warnings so there's little point in doing that.
This makes riscv's forced-atomics
the only remaining "forbidden" feature.
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.
That makes sense to me.
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.
My understanding is that while it changes some error outputs, this PR shouldn't have any practical effect on people, correct? Except those using our unstable target-spec.json, I suppose, and they bought the ticket for the ride they're going to get.
r=me with nits addressed
match s.parse::<super::RustcAbi>() { | ||
Ok(rustc_abi) => base.$key_name = Some(rustc_abi), | ||
_ => return Some(Err(format!( | ||
"'{s}' is not a valid value for rust-abi. \ |
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.
"'{s}' is not a valid value for rust-abi. \ | |
"'{s}' is not a valid value for rustc-abi. \ |
/// The Rustc-specific variant of the ABI used for this target. | ||
#[derive(Clone, Copy, PartialEq, Hash, Debug)] | ||
pub enum RustcAbi { | ||
/// On x86-32/64 only: do not use any FPU or SIMD registers for the ABI/ |
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 "ABI/"?
Correct, for custom target specs this can add Maybe we should land #136147 first; that would avoid changing behavior for target-spec users and instead just emit a warning. |
I'm not worried about being maximally convenient for them, but either way. I'll try to review that when I finish my tea. |
Could not assign reviewer from: |
☔ The latest upstream changes (presumably #136225) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r=workingjubilee |
This comment has been minimized.
This comment has been minimized.
@bors r- |
a06c57d
to
7ea032d
Compare
@workingjubilee I have done a pass over the tests to ensure we cover both enabling and disabling of "forbidden" and of ABI-relevant target features... please take a look. |
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.
x87 is just a normal target feature now, it didn't seem worth having a test for it.
This comment has been minimized.
This comment has been minimized.
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 have a nit apparently.
tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs
Outdated
Show resolved
Hide resolved
tests/ui/target-feature/forbidden-hardfloat-target-feature-flag.rs
Outdated
Show resolved
Hide resolved
@@ -1,11 +1,12 @@ | |||
//@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=lib | |||
//@ needs-llvm-components: x86 | |||
//! Ensure "forbidden" target features cannot be enabled via `#[target_feature]`. |
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.
thanks for better documenting these!
…and use it for x86 softfloat
Fixed :) |
cool, r=me with a cleared CI |
Part of #135408:
Instead of choosing this based on the target features listed in the target spec, make that choice explicit.
This means that all x86 (32bit and 64bit) softfloat target need to explicitly set
rustc-abi
tox86-softfloat
.Also fix some mistakes in the platform-docs where the x87 errata footnotes were missing or wrong.