-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
prefer actual ABI-controling fields over target.abi when making ABI decisions #152941
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
Open
RalfJung
wants to merge
1
commit into
rust-lang:main
Choose a base branch
from
RalfJung:abi-control
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+37
−28
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
compiler/rustc_target/src/spec/targets/aarch64v8r_unknown_none_softfloat.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet}; | |
| use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; | ||
| use rustc_span::{Symbol, sym}; | ||
|
|
||
| use crate::spec::{Abi, Arch, FloatAbi, RustcAbi, Target}; | ||
| use crate::spec::{Arch, FloatAbi, RustcAbi, Target}; | ||
|
|
||
| /// Features that control behaviour of rustc, rather than the codegen. | ||
| /// These exist globally and are not in the target-specific lists below. | ||
|
|
@@ -1170,17 +1170,21 @@ impl Target { | |
| Arch::AArch64 | Arch::Arm64EC => { | ||
| // Aarch64 has no sane ABI specifier, and LLVM doesn't even have a way to force | ||
| // the use of soft-float, so all we can do here is some crude hacks. | ||
| if self.abi == Abi::SoftFloat { | ||
| // LLVM will use float registers when `fp-armv8` is available, e.g. for | ||
| // calls to built-ins. The only way to ensure a consistent softfloat ABI | ||
| // on aarch64 is to never enable `fp-armv8`, so we enforce that. | ||
| // In Rust we tie `neon` and `fp-armv8` together, therefore `neon` is the | ||
| // feature we have to mark as incompatible. | ||
| FeatureConstraints { required: &[], incompatible: &["neon"] } | ||
| } else { | ||
| // Everything else is assumed to use a hardfloat ABI. neon and fp-armv8 must be enabled. | ||
| // `FeatureConstraints` uses Rust feature names, hence only "neon" shows up. | ||
| FeatureConstraints { required: &["neon"], incompatible: &[] } | ||
| match self.rustc_abi { | ||
|
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. This actually seems like a great improvement in consistency; every other |
||
| Some(RustcAbi::Softfloat) => { | ||
| // LLVM will use float registers when `fp-armv8` is available, e.g. for | ||
| // calls to built-ins. The only way to ensure a consistent softfloat ABI | ||
| // on aarch64 is to never enable `fp-armv8`, so we enforce that. | ||
| // In Rust we tie `neon` and `fp-armv8` together, therefore `neon` is the | ||
| // feature we have to mark as incompatible. | ||
| FeatureConstraints { required: &[], incompatible: &["neon"] } | ||
| } | ||
| None => { | ||
| // Everything else is assumed to use a hardfloat ABI. neon and fp-armv8 must be enabled. | ||
| // `FeatureConstraints` uses Rust feature names, hence only "neon" shows up. | ||
| FeatureConstraints { required: &["neon"], incompatible: &[] } | ||
| } | ||
| Some(r) => panic!("invalid Rust ABI for aarch64: {r:?}"), | ||
| } | ||
| } | ||
| Arch::RiscV32 | Arch::RiscV64 => { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
We don't actually use
RustcAbi::Softfloaton powerpc currently.@Gelbpunkt Do we even have a powerpc softfloat target and how does it work? @folkertdev which target was this check supposed to deal with?
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.
We don't have softfloat powerpc targets at the moment, but I'm pretty sure the RfL people will want to add one? Not sure what the plans are for that...