forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#84004 - mattico:print-target-features-improve…
…ments, r=petrochenkov Categorize and explain target features support There are 3 different uses of the `-C target-feature` args passed to rustc: 1. All of the features are passed to LLVM, which uses them to configure code-generation. This is sort-of stabilized since 1.0 though LLVM does change/add/remove target features regularly. 2. Target features which are in [the compiler's allowlist](https://github.com/rust-lang/rust/blob/69e1d22ddbc67b25141a735a22a8895a678b32ca/compiler/rustc_codegen_ssa/src/target_features.rs#L12-L34) can be used in `cfg!(target_feature)` etc. These may have different names than in LLVM and are renamed before passing them to LLVM. 3. Target features which are in the allowlist and which are stabilized or feature-gate-enabled can be used in `#[target_feature]`. It can be confusing that `rustc --print target-features` just prints out the LLVM features without separating out the rustc features or even mentioning that the dichotomy exists. This improves the situation by separating out the rustc and LLVM target features and adding a brief explanation about the difference. Abbreviated Example Output: ``` $ rustc --print target-features Features supported by rustc for this target: adx - Support ADX instructions. aes - Enable AES instructions. ... xsaves - Support xsaves instructions. crt-static - Enables libraries with C Run-time Libraries(CRT) to be statically linked. Code-generation features supported by LLVM for this target: 16bit-mode - 16-bit mode (i8086). 32bit-mode - 32-bit mode (80386). ... x87 - Enable X87 float instructions. xop - Enable XOP instructions. Use +feature to enable a feature, or -feature to disable it. For example, rustc -C target-cpu=mycpu -C target-feature=+feature1,-feature2 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. ``` Motivated by rust-lang#83975. CC rust-lang#49653
- Loading branch information
Showing
3 changed files
with
91 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters