Repository navigation
add target feature ABI checks for SPARC - #160562
Conversation
|
These commits modify compiler targets. |
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
Ah, the |
| VecDefault = "vec-default", | ||
| VecExtAbi = "vec-extabi", | ||
| X32 = "x32", | ||
| V8Plus = "v8plus", |
There was a problem hiding this comment.
Do we need any kind of process for a new cfg value here?
This comment has been minimized.
This comment has been minimized.
|
@rustbot reroll |
|
@rustbot reroll |
|
I don't really know anything about SPARC nor have I touched the compiler machinery for these checks yet. Maybe one of the people pinged earlier wants to take this? If not, I guess that's my chance to learn some more funny cursed trivia, but it'll take a while. |
This comment has been minimized.
This comment has been minimized.
|
These commits modify compiler targets. |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
AFAIK this only applies to |
|
Oh, right. |
|
We're going with "v8plus": #t-compiler/major changes > Expose `target_abi = "v8plus"` on sparc-… compiler-team#1028 @ 💬. This PR is ready then :) |
|
r? @tgross35 |
|
|
| match self.rustc_abi { | ||
| None => FeatureConstraints { | ||
| required: &[], | ||
| incompatible: &["soft-float", "v8plus"], | ||
| }, | ||
| Some(RustcAbi::SparcV8Plus) => { | ||
| FeatureConstraints { required: &["v8plus"], incompatible: &["soft-float"] } | ||
| } | ||
| _ => unreachable!(), | ||
| } | ||
| } | ||
| Arch::Sparc64 => { | ||
| // We currently don't have a soft-float target for SPARC64. | ||
| // v8plus is for 32bit SPARC only. | ||
| FeatureConstraints { required: &[], incompatible: &["soft-float", "v8plus"] } |
There was a problem hiding this comment.
Does the incompatible list make these target modifiers and prevent linking? I'm not sure whether that is something we should be testing.
There was a problem hiding this comment.
This system predates target modifiers so it is currently unrelated (though I am trying to marry them in #160593).
What this does is emit a warning whenever these target features are enabled via -Ctarget-feature or even implicitly via -Ctarget-cpu (with a note that this warning will become a hard error eventually). It also causes a hard error when they are enabled via #[target_feature].
add target feature ABI checks for SPARC Fixes rust-lang#157083 MCP: rust-lang/compiler-team#1028 Cc @psumbera @kulikjak @workingjubilee @taiki-e @jonathanpallant I hope this makes sense :)
add target feature ABI checks for SPARC Fixes rust-lang#157083 MCP: rust-lang/compiler-team#1028 Cc @psumbera @kulikjak @workingjubilee @taiki-e @jonathanpallant I hope this makes sense :)
…uwer Rollup of 21 pull requests Successful merges: - #158609 (Update sccache to 0.16.0) - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160562 (add target feature ABI checks for SPARC) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #161456 (reduce perf impact of scalar size checks) - #161528 (Add regression test to ensure optimal compilation) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161859 (Do not optimize MIR for comptime ConstFns) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - #161889 (Add link to ownership section in ptr::read docs) - #161890 (rustdoc: some clarifying comments) - #161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - #161702 (Use `drop_guard` in some places in {core,alloc,std})
…uwer Rollup of 21 pull requests Successful merges: - #150075 (Implement clamp_to) - #159103 (fix(reborrow): recursive implementation) - #160562 (add target feature ABI checks for SPARC) - #160848 (std: avoid aliasing violations when wrapping opaque C types) - #161421 (Include startup crt objects on WASI for more outputs) - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - #161862 (Put data segment in specified section with link_section on wasm) - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - #157218 (Track items behind `cfg_select` in the same way we do for `cfg`) - #161456 (reduce perf impact of scalar size checks) - #161528 (Add regression test to ensure optimal compilation) - #161666 (Print vendor instructions in `x vendor`) - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - #161828 (Never type after-stabilization cleanup) - #161859 (Do not optimize MIR for comptime ConstFns) - #161860 (atomicptr.rs test: remove unused import) - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - #161889 (Add link to ownership section in ptr::read docs) - #161890 (rustdoc: some clarifying comments) - #161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - #161702 (Use `drop_guard` in some places in {core,alloc,std})
Rollup merge of #160562 - RalfJung:sparc, r=tgross35 add target feature ABI checks for SPARC Fixes #157083 MCP: rust-lang/compiler-team#1028 Cc @psumbera @kulikjak @workingjubilee @taiki-e @jonathanpallant I hope this makes sense :)
…nathanBrouwer Rollup of 21 pull requests Successful merges: - rust-lang#150075 (Implement clamp_to) - rust-lang#159103 (fix(reborrow): recursive implementation) - rust-lang#160562 (add target feature ABI checks for SPARC) - rust-lang#160848 (std: avoid aliasing violations when wrapping opaque C types) - rust-lang#161421 (Include startup crt objects on WASI for more outputs) - rust-lang#161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - rust-lang#161862 (Put data segment in specified section with link_section on wasm) - rust-lang#161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - rust-lang#157218 (Track items behind `cfg_select` in the same way we do for `cfg`) - rust-lang#161456 (reduce perf impact of scalar size checks) - rust-lang#161528 (Add regression test to ensure optimal compilation) - rust-lang#161666 (Print vendor instructions in `x vendor`) - rust-lang#161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - rust-lang#161828 (Never type after-stabilization cleanup) - rust-lang#161859 (Do not optimize MIR for comptime ConstFns) - rust-lang#161860 (atomicptr.rs test: remove unused import) - rust-lang#161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - rust-lang#161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - rust-lang#161889 (Add link to ownership section in ptr::read docs) - rust-lang#161890 (rustdoc: some clarifying comments) - rust-lang#161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - rust-lang#161702 (Use `drop_guard` in some places in {core,alloc,std})
…uwer Rollup of 21 pull requests Successful merges: - rust-lang/rust#150075 (Implement clamp_to) - rust-lang/rust#159103 (fix(reborrow): recursive implementation) - rust-lang/rust#160562 (add target feature ABI checks for SPARC) - rust-lang/rust#160848 (std: avoid aliasing violations when wrapping opaque C types) - rust-lang/rust#161421 (Include startup crt objects on WASI for more outputs) - rust-lang/rust#161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order) - rust-lang/rust#161862 (Put data segment in specified section with link_section on wasm) - rust-lang/rust#161866 (delegation: add tests fixating behavior of delegating to default trait implementations) - rust-lang/rust#157218 (Track items behind `cfg_select` in the same way we do for `cfg`) - rust-lang/rust#161456 (reduce perf impact of scalar size checks) - rust-lang/rust#161528 (Add regression test to ensure optimal compilation) - rust-lang/rust#161666 (Print vendor instructions in `x vendor`) - rust-lang/rust#161730 (Improve type mismatch annotation for lets with block-wrapped initializers) - rust-lang/rust#161828 (Never type after-stabilization cleanup) - rust-lang/rust#161859 (Do not optimize MIR for comptime ConstFns) - rust-lang/rust#161860 (atomicptr.rs test: remove unused import) - rust-lang/rust#161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods) - rust-lang/rust#161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`) - rust-lang/rust#161889 (Add link to ownership section in ptr::read docs) - rust-lang/rust#161890 (rustdoc: some clarifying comments) - rust-lang/rust#161891 (Mark `extern_item_impls` feature as incomplete) Failed merges: - rust-lang/rust#161702 (Use `drop_guard` in some places in {core,alloc,std})
…res, r=davidtwco turn ABI-controlling target features into a target modifier This makes it so that we can mark "internal" target features (which we track as target features in the compiler but do not expose as such to the user) as target modifiers, to be *really* sure that they are set consistently across all targets. For instance, if there was a value for `-Ctarget-cpu` that affected ABI-relevant target features, we'd catch mismatches in the value of that target feature. For now, this just complements the ABI check logic in `abi_required_features`, but I think long-term it might even be able to fully replace that logic. This would, for example, let us check consistency of the SPARC ABI (rust-lang#160562) without introducing a new variant for `RustcAbi`. OTOH having the ABI represented explicitly is often useful elsewhere in the compiler (e.g. for inline asm) so we may also want to keep both `abi_required_features` and this new concept of "target features that must be consistent across all crates". We could also eventually turn the target modifier into a safety net: if `abi_required_features` violations are a hard error and `-Ctarget-feature` is locked down to reject non-Rust target features, it should be impossible to ever violate the new target modifier check. Cc @Darksonn @workingjubilee
…res, r=davidtwco turn ABI-controlling target features into a target modifier This makes it so that we can mark "internal" target features (which we track as target features in the compiler but do not expose as such to the user) as target modifiers, to be *really* sure that they are set consistently across all targets. For instance, if there was a value for `-Ctarget-cpu` that affected ABI-relevant target features, we'd catch mismatches in the value of that target feature. For now, this just complements the ABI check logic in `abi_required_features`, but I think long-term it might even be able to fully replace that logic. This would, for example, let us check consistency of the SPARC ABI (rust-lang#160562) without introducing a new variant for `RustcAbi`. OTOH having the ABI represented explicitly is often useful elsewhere in the compiler (e.g. for inline asm) so we may also want to keep both `abi_required_features` and this new concept of "target features that must be consistent across all crates". We could also eventually turn the target modifier into a safety net: if `abi_required_features` violations are a hard error and `-Ctarget-feature` is locked down to reject non-Rust target features, it should be impossible to ever violate the new target modifier check. Cc @Darksonn @workingjubilee
…res, r=davidtwco turn ABI-controlling target features into a target modifier This makes it so that we can mark "internal" target features (which we track as target features in the compiler but do not expose as such to the user) as target modifiers, to be *really* sure that they are set consistently across all targets. For instance, if there was a value for `-Ctarget-cpu` that affected ABI-relevant target features, we'd catch mismatches in the value of that target feature. For now, this just complements the ABI check logic in `abi_required_features`, but I think long-term it might even be able to fully replace that logic. This would, for example, let us check consistency of the SPARC ABI (rust-lang#160562) without introducing a new variant for `RustcAbi`. OTOH having the ABI represented explicitly is often useful elsewhere in the compiler (e.g. for inline asm) so we may also want to keep both `abi_required_features` and this new concept of "target features that must be consistent across all crates". We could also eventually turn the target modifier into a safety net: if `abi_required_features` violations are a hard error and `-Ctarget-feature` is locked down to reject non-Rust target features, it should be impossible to ever violate the new target modifier check. Cc @Darksonn @workingjubilee
Rollup merge of #160593 - RalfJung:abi-relevant-target-features, r=davidtwco turn ABI-controlling target features into a target modifier This makes it so that we can mark "internal" target features (which we track as target features in the compiler but do not expose as such to the user) as target modifiers, to be *really* sure that they are set consistently across all targets. For instance, if there was a value for `-Ctarget-cpu` that affected ABI-relevant target features, we'd catch mismatches in the value of that target feature. For now, this just complements the ABI check logic in `abi_required_features`, but I think long-term it might even be able to fully replace that logic. This would, for example, let us check consistency of the SPARC ABI (#160562) without introducing a new variant for `RustcAbi`. OTOH having the ABI represented explicitly is often useful elsewhere in the compiler (e.g. for inline asm) so we may also want to keep both `abi_required_features` and this new concept of "target features that must be consistent across all crates". We could also eventually turn the target modifier into a safety net: if `abi_required_features` violations are a hard error and `-Ctarget-feature` is locked down to reject non-Rust target features, it should be impossible to ever violate the new target modifier check. Cc @Darksonn @workingjubilee
View all comments
Fixes #157083
MCP: rust-lang/compiler-team#1028
Cc @psumbera @kulikjak @workingjubilee @taiki-e @jonathanpallant I hope this makes sense :)