-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Codegen features are no longer recognized by rustc #96472
Comments
This is caused by #87402 which contains some motivation for displaying a warning. |
When doing a local rebuild of rustc I'm getting the following which I think is related:
|
The warnings reported by @bjorn3 are the symptom of an unrelated bug in the |
…etrochenkov Add missing `target_feature` to the list of well known cfg names This PR adds the missing `target_feature` cfg name to the list of well known cfg names. It was notice missing in rust-lang#96472 thanks to `@bjorn3,` the reason being that `--check-cfg=names()` automatically inherit the names passed by `--cfg` (or internal to `rustc`) and is seems that the vast majority of targets have at least one target feature leading to `target_feature` being a well known name in most target but it should always be a well known name so this PR add it unconditionally to list. r? `@petrochenkov`
Removing the regression flag as discussed in the Zulip thread of the Prioritization Working Group. Although this looks to the end user as a regression, as explained in the comments here this is more a case of unhelpful/incomplete warning message. A patch could probably improve on that. @rustbot label -I-prioritize -regression-from-stable-to-beta |
It might be nice to (in addition) suggest to move the unknown feature to the custom target specification file if such a file was used to begin with instead of a built-in target. |
…t spec file Only a subset of the LLVM codegen features are recognized by `rustc`, and since rust-lang/rust#87402 (Rust 1.61.0) the compiler gives a warning about it: warning: unknown feature specified for `-Ctarget-feature`: `mmx` | = note: it is still passed through to the codegen backend = note: consider filing a feature request ...since those features may be renamed or removed at any point: $ rustc --print target-features [...] Code-generation features cannot be used in cfg or #[target_feature], and may be renamed or removed in a future version of LLVM or rustc. Thus move them back to the target spec generated file. See rust-lang/rust#96472 as well for a report. Signed-off-by: Miguel Ojeda <[email protected]>
…t spec file Only a subset of the LLVM codegen features are recognized by `rustc`, and since rust-lang/rust#87402 (Rust 1.61.0) the compiler gives a warning about it: warning: unknown feature specified for `-Ctarget-feature`: `mmx` | = note: it is still passed through to the codegen backend = note: consider filing a feature request ...since those features may be renamed or removed at any point: $ rustc --print target-features [...] Code-generation features cannot be used in cfg or #[target_feature], and may be renamed or removed in a future version of LLVM or rustc. Thus move them back to the target spec generated file. See rust-lang/rust#96472 as well for a report. Signed-off-by: Miguel Ojeda <[email protected]>
I stumbled on this bug and did't understand why this is a suboptimal diagnostic and not a regression. The bug report uses So unless I'm simply clueless on whats actually going on here, I believe this issue can be closed. |
Because it is still passed to LLVM even if rustc doesn't understand it. Rustc itself didn't understand it in the past either, but it did pass them through to LLVM. The only difference is that rustc now gives a warning if it doesn't understand a feature. |
Ah! Thanks @bjorn3! Just to clarify then, |
Add `sign-ext` target feature to the WASM target Some target features are still missing from that list. See rust-lang#97808 for basically the same PR by `@alexcrichton.` Related issue: rust-lang#96472. PR introducing this issue: rust-lang#87402.
Does this warning actually indicate a real problem, or is it just "Hey, you should ask the rust-lang devs to add this to the list of known/sanctioned LLVM codegen options"? If it's not actually indicating a real problem, is there a way to suppress the warning? It's unclear from the warning message what I need to pass to suppress it. My team uses an LLVM option not recognized by rustc, and the noise from this warning actively pushes us away from upgrading past 1.60. |
We could offer a way to suppress the warning, but then users would not request that we canonicalize in rustc the target features LLVM currently recognizes and Rust does not, as they would simply turn off the warning instead. I understand it can be quite annoying, but the reason to have these canonicalizing mappings is not just an abstract decision about supporting multiple codegen backends. It is at least partly to make it so that we do not expose features LLVM may decide to change its support levels for, as happened with e.g. This applies to target features because LLVM reserves the right to change its own target feature definitions and has in the recent past, which is part of why we now map certain features to multiple features, now: rust/compiler/rustc_codegen_llvm/src/llvm_util.rs Lines 177 to 182 in 0f4bcad
Without a canonicalizing mapping in Rust's lowering, any target feature you use may break on the next LLVM upgrade if you are using our bundled LLVM. LLVM cuts releases on a 6 month cadence. We try to offer more stable interfaces in rustc than "my code works today, but in six months it may break". Target featureful code is effectively With that prelude, to answer your question:
|
…t spec file Similar to c5eae3a ("x86: rust: move unknown-to-`rustc` codegen features back to the target spec file"), but for `retpoline-external-thunk`: Only a subset of the LLVM codegen features are recognized by `rustc`, and since rust-lang/rust#87402 (Rust 1.61.0) the compiler gives a warning about it: warning: unknown feature specified for `-Ctarget-feature`: `mmx` | = note: it is still passed through to the codegen backend = note: consider filing a feature request ...since those features may be renamed or removed at any point: $ rustc --print target-features [...] Code-generation features cannot be used in cfg or #[target_feature], and may be renamed or removed in a future version of LLVM or rustc. Thus move them back to the target spec generated file. See rust-lang/rust#96472 as well for a report. Signed-off-by: Miguel Ojeda <[email protected]>
…t spec file Similar to c5eae3a ("x86: rust: move unknown-to-`rustc` codegen features back to the target spec file"), but for `retpoline-external-thunk`: Only a subset of the LLVM codegen features are recognized by `rustc`, and since rust-lang/rust#87402 (Rust 1.61.0) the compiler gives a warning about it: warning: unknown feature specified for `-Ctarget-feature`: `mmx` | = note: it is still passed through to the codegen backend = note: consider filing a feature request ...since those features may be renamed or removed at any point: $ rustc --print target-features [...] Code-generation features cannot be used in cfg or #[target_feature], and may be renamed or removed in a future version of LLVM or rustc. Thus move them back to the target spec generated file. See rust-lang/rust#96472 as well for a report. Signed-off-by: Miguel Ojeda <[email protected]>
I suspect that what might be a good general solution to the D-confusing part of this issue is to rework this issue (or open a new tracking issue) with more information on what this is, and link the issue from the diagnostic. We already do something along the lines for the future compatibility warnings, and this is kinda similar in nature. |
Add `multivalue` target feature to WASM target This PR is similar to rust-lang#99643 and rust-lang#97808. It addresses rust-lang#96472 for the `multivalue` target feature. The problem I am trying to fix is to remove the following warning when compiling with `-C target-feature=+multivalue` for `--target=wasm32-unknown-unknown`. ``` warning: unknown feature specified for `-Ctarget-feature`: `multivalue` | = note: it is still passed through to the codegen backend = note: consider filing a feature request ```
On stable, giving additional codegen features to rustc works as expected, for example:
On beta and nightly, compiling with the same options works too, but warns that the feature is not recognized.
Target features work well.
This may be caused by #95202.
Version it worked on
It most recently worked on: 1.60
Version with regression
Beta (1.61)
rustc --version --verbose
:@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged
The text was updated successfully, but these errors were encountered: