Repository navigation
turn ABI-controlling target features into a target modifier - #160593
Conversation
|
Some changes occurred in cfg and check-cfg configuration cc @Urgau
cc @rust-lang/miri
cc @bjorn3 These commits modify compiler targets.
|
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| /// Store values for target modifiers. `gather_target_modifiers` takes those values | ||
| /// to decide what to store in metadata. | ||
| pub target_modifiers: BTreeMap<OptionsTargetModifiers, String>, |
There was a problem hiding this comment.
FWIW I could not quite understand why we have both this map and some extra logic in gather_target_modifiers. When I found this map I had assumed that the entire contents of this map will be stored as target modifier, but instead there's a separate filtering step. Why?
Cc @azhogin
0adef58 to
d87b168
Compare
|
r? @davidtwco |
d87b168 to
1f4476d
Compare
This comment has been minimized.
This comment has been minimized.
1f4476d to
7569daa
Compare
This comment has been minimized.
This comment has been minimized.
7569daa to
b6f8895
Compare
|
I tried the flag from the new help text, but rustc rejects it before it gets a chance to suppress anything: for comparison, fixed-x18 is accepted:
|
|
Good point, thanks. Ideally we'd do "synthetic target modifiers" in a less hacky way so we can't as easily forget this. But I'll wait to hear from the folks that are working on the target modifier machinery (mainly @davidtwco I think?) before doing that. For now I'll add tests and ad-hoc fixes so we have a baseline for a refactor later. |
b6f8895 to
9fe6263
Compare
There was a problem hiding this comment.
This makes sense to me, feel free to r=me now if you want to see this land sooner rather than later but it will conflict heavily with #160167 (as does everything that touches target modifiers at the moment), so I wouldn't mind if we waited.
|
What's the timeline for #160167 ? This one isn't in a rush but I'd also hate to see it bitrot. |
Just as soon as someone reviews it and wants to approve the patch. I don't expect to add synthetic target modifiers to it just because it's already large but I think it's probably about as extensible as the current impl, just with way fewer macros. |
|
Fewer macros sounds good :) |
This comment has been minimized.
This comment has been minimized.
As described in more detail in #160167 (comment) there are tradeoffs in landing that PR, and we don't think it's really worth it in practice. It should be closed soon. I'm mentioning that here to consider this PR both unblocked and ready to land after a rebase, as David has already reviewed it. |
9fe6263 to
2eaa9db
Compare
|
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. |
192d421 to
59c9b70
Compare
59c9b70 to
88120e6
Compare
I have rebased this. The only notable change is that the logic to populate the @bors r=davidtwco |
…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 of 13 pull requests Successful merges: - #163477 (Fancy paramenv accessors that communicate the access pattern better.) - #160593 (turn ABI-controlling target features into a target modifier) - #164896 (offload: pass the linked device image to the host pass) - #165468 (Remove return type from `BuilderMethods::store`) - #159374 (Lower #[no_mangle] to #[symbol_name]/#[link_name]) - #164564 (Re-enable outline-atomics by default on more AArch64 platforms) - #164623 (add next-solver regression tests for two fixed ices) - #164678 (add next-solver regression test for recursive opaque ICE under validate-mir) - #165429 (Add tests for `-Zcrate-attr` edition and position) - #165430 ([tiny] Show context for found assoc item in E0107) - #165456 (std: Fix build for the L4Re targets) - #165463 (Add BTreeMap::allocator and BTreeSet::allocator) - #165466 (Don't "exit" using `panic` on teeos)
Rollup of 15 pull requests Successful merges: - #163477 (Fancy paramenv accessors that communicate the access pattern better.) - #160593 (turn ABI-controlling target features into a target modifier) - #164896 (offload: pass the linked device image to the host pass) - #165468 (Remove return type from `BuilderMethods::store`) - #164564 (Re-enable outline-atomics by default on more AArch64 platforms) - #164623 (add next-solver regression tests for two fixed ices) - #164653 (Deprecate internal function `vec::from_elem`) - #164678 (add next-solver regression test for recursive opaque ICE under validate-mir) - #165387 (windows OpenOptionsExt examples: replace winapi by windows crate) - #165429 (Add tests for `-Zcrate-attr` edition and position) - #165430 ([tiny] Show context for found assoc item in E0107) - #165456 (std: Fix build for the L4Re targets) - #165463 (Add BTreeMap::allocator and BTreeSet::allocator) - #165466 (Don't "exit" using `panic` on teeos) - #165491 (Remove unused compiler types and associated helpers)
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
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-cputhat 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 forRustcAbi. 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 bothabi_required_featuresand 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: ifabi_required_featuresviolations are a hard error and-Ctarget-featureis locked down to reject non-Rust target features, it should be impossible to ever violate the new target modifier check.Cc @Darksonn @workingjubilee