-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
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 |
…and use it for x86 softfloat
@jackpot51 heads-up that Redox will have to explicitly select the x86 softfloat ABI once this lands, similar to what was needed for Linux. |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f027438): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -0.8%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 779.425s -> 778.951s (-0.06%) |
Required to enable the soft-float feature. See rust-lang/rust#136146
When using Rust on the x86 architecture, we are currently using the unstable target.json feature to specify the compilation target. Rustc is going to change how softfloat is specified in the target.json file on x86, thus update generate_rust_target.rs to specify softfloat using the new option. Note that if you enable this parameter with a compiler that does not recognize it, then that triggers a warning but it does not break the build. Cc: <[email protected]> # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Link: rust-lang/rust#136146 Signed-off-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added 6.13.y too to Cc: stable tag and added reasoning to avoid over-backporting. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
When using Rust on the x86 architecture, we are currently using the unstable target.json feature to specify the compilation target. Rustc is going to change how softfloat is specified in the target.json file on x86, thus update generate_rust_target.rs to specify softfloat using the new option. Note that if you enable this parameter with a compiler that does not recognize it, then that triggers a warning but it does not break the build. [ For future reference, this solves the following error: RUSTC L rust/core.o error: Error loading target specification: target feature `soft-float` is incompatible with the ABI but gets enabled in target spec. Run `rustc --print target-list` for a list of built-in targets - Miguel ] Cc: <[email protected]> # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Link: rust-lang/rust#136146 Signed-off-by: Alice Ryhl <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added 6.13.y too to Cc: stable tag and added reasoning to avoid over-backporting. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
When using Rust on the x86 architecture, we are currently using the unstable target.json feature to specify the compilation target. Rustc is going to change how softfloat is specified in the target.json file on x86, thus update generate_rust_target.rs to specify softfloat using the new option. Note that if you enable this parameter with a compiler that does not recognize it, then that triggers a warning but it does not break the build. [ For future reference, this solves the following error: RUSTC L rust/core.o error: Error loading target specification: target feature `soft-float` is incompatible with the ABI but gets enabled in target spec. Run `rustc --print target-list` for a list of built-in targets - Miguel ] Cc: <[email protected]> # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Link: rust-lang/rust#136146 Signed-off-by: Alice Ryhl <[email protected]> Acked-by: Dave Hansen <[email protected]> # for x86 Link: https://lore.kernel.org/r/[email protected] [ Added 6.13.y too to Cc: stable tag and added reasoning to avoid over-backporting. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
@@ -28,7 +28,7 @@ rm -rf linux || true | |||
# Download Linux at a specific commit | |||
mkdir -p linux | |||
git -C linux init | |||
git -C linux remote add origin https://github.com/Rust-for-Linux/linux.git | |||
git -C linux remote add origin https://github.com/Darksonn/linux.git |
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.
this needs a cfg(bootstrap) to get bumped on release
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 don't follow, what does the Linux kernel have to do with bootstraping?
I think I did everything mentioned at https://rustc-dev-guide.rust-lang.org/tests/rust-for-linux.html.
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.
Oops, I missed that the maintainers have taken responsibility for flipping this back and don't need extra reminders from Release.
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 don't follow, what does the Linux kernel have to do with bootstraping?
I think I did everything mentioned at https://rustc-dev-guide.rust-lang.org/tests/rust-for-linux.html.
I am confused too -- this seems fine.
When v6.14-rc3 releases in a couple weeks, which is the one I am planning to get the fix into, I will send a PR with that tag, and we will be in the normal situation again.
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.
Oops, I missed that the maintainers have taken responsibility for flipping this back and don't need extra reminders from Release.
I don't think there is a technical requirement to flip it back. I mean, the idea is that we do so, but it is orthogonal to the release, no? It is just a CI test. For instance, in an ideal world, we could be testing several supported Linux versions (e.g. the latest LTS).
This additional field is required by the Rust compiler since rust-lang/rust#136146 .
The Rust compiler now requires an explicit `rustc-abi: x86-softfloat` field when using the soft-float target feature. This was added in rust-lang/rust#136146 and is part of the latest nightlies. I updated the post branches in commit 688a21e
commit 6273a05 upstream. When using Rust on the x86 architecture, we are currently using the unstable target.json feature to specify the compilation target. Rustc is going to change how softfloat is specified in the target.json file on x86, thus update generate_rust_target.rs to specify softfloat using the new option. Note that if you enable this parameter with a compiler that does not recognize it, then that triggers a warning but it does not break the build. [ For future reference, this solves the following error: RUSTC L rust/core.o error: Error loading target specification: target feature `soft-float` is incompatible with the ABI but gets enabled in target spec. Run `rustc --print target-list` for a list of built-in targets - Miguel ] Cc: <[email protected]> # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs). Link: rust-lang/rust#136146 Signed-off-by: Alice Ryhl <[email protected]> Acked-by: Dave Hansen <[email protected]> # for x86 Link: https://lore.kernel.org/r/[email protected] [ Added 6.13.y too to Cc: stable tag and added reasoning to avoid over-backporting. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
Part of #135408:
Instead of choosing this based on the target features listed in the target spec, make that choice explicit.
All built-in targets are being updated here; custom (JSON-defined) x86 (32bit and 64bit) softfloat targets need to explicitly set
rustc-abi
tox86-softfloat
.