turn ABI-controlling target features into a target modifier - #160593
turn ABI-controlling target features into a target modifier#160593RalfJung wants to merge 4 commits into
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 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
Stacked on top of #160530, only the last commit is new.