-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc_target: The differences between target_os = "none"
and target_os = "unknown"
, and target_vendor = "unknown"
and target_vendor = ""
are unclear
#77730
Comments
For OS, Generally a missing component of the triple is supposed to be interpreted as "unknown". I think it might be reasonable to use "unknown" instead of an empty string in the Target definition, though I'm not sure if it matters too much in practice. Generally people only care about the canonical target string (like This is sorta documented at https://doc.rust-lang.org/cargo/appendix/glossary.html#target (which is derived from https://clang.llvm.org/docs/CrossCompilation.html#target-triple, which is in turn derived from GNU AIUI). https://doc.rust-lang.org/rustc/targets/index.html should probably discuss this in more detail. |
…crum rustc_target: Move some target options from `Target` to `TargetOptions` The only reason for `Target` to `TargetOptions` to be separate structures is that options in `TargetOptions` have reasonable defaults and options in `Target` don't. (Otherwise all the options logically belong to a single `Target` struct.) This PR moves a number of options with reasonable defaults from `Target` to `TargetOptions`, so they no longer needs to be specified explicitly for majority of the targets. The move also allows to inherit the options from `rustc_target/src/spec/*_base.rs` files in a nicer way. I didn't change any specific option values here. The moved options are `target_c_int_width` (defaults to `"32"`), `target_endian` (defaults to `"little"`), `target_os` (defaults to `"none"`), `target_env` (defaults to `""`), `target_vendor` (defaults to `"unknown"`) and `linker_flavor` (defaults to `LinkerFlavor::Gcc`). Next steps (in later PRs): - Find a way to merge `TargetOptions` into `Target` - If not, always access `TargetOptions` fields through `Deref` making it a part of `Target` at least logically (`session.target.target.options.foo` -> `session.target.target.foo`) - ~Eliminate `session::config::Config` and use `Target` instead (`session.target.target.foo` -> `session.target.foo`)~ Done in rust-lang#77943. - Avoid tautologies in option names (`target.target_os` -> `target.os`) - Resolve _ rust-lang#77730 (rustc_target: The differences between `target_os = "none"` and `target_os = "unknown"`, and `target_vendor = "unknown"` and `target_vendor = ""` are unclear) noticed during implementation of this PR.
rustc_target: Change os and vendor values to "none" and "unknown" for some targets Closes rust-lang#77730 r? `@ehuss`
rustc_target: Change os and vendor values to "none" and "unknown" for some targets Closes rust-lang#77730 r? ``@ehuss``
rustc_target: Change os and vendor values to "none" and "unknown" for some targets Closes rust-lang#77730 r? ```@ehuss```
The majority of targets use
target_os = "none"
/target_vendor = "unknown"
respectively, but some targets deviate and usetarget_os = "unknown"
/target_vendor = ""
.Possible solutions:
The text was updated successfully, but these errors were encountered: