diff options
| author | Ralf Jung <post@ralfj.de> | 2025-06-14 14:11:00 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-06-19 10:50:03 +0900 |
| commit | a50a3b8e318594c41783294e440d864763e412ef (patch) | |
| tree | 4d037d526deed94229c3b156e252f36b6c12827a /compiler/rustc_codegen_llvm/src | |
| parent | 0c4b0f57268b1e866eb7eb720caf815efcb85aeb (diff) | |
| download | rust-a50a3b8e318594c41783294e440d864763e412ef.tar.gz rust-a50a3b8e318594c41783294e440d864763e412ef.zip | |
various minor target feature cleanups
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm_util.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs index 676890b36eb..6fd07d562af 100644 --- a/compiler/rustc_codegen_llvm/src/llvm_util.rs +++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs @@ -625,6 +625,15 @@ pub(crate) fn target_cpu(sess: &Session) -> &str { /// The target features for compiler flags other than `-Ctarget-features`. fn llvm_features_by_flags(sess: &Session, features: &mut Vec<String>) { target_features::retpoline_features_by_flags(sess, features); + + // -Zfixed-x18 + if sess.opts.unstable_opts.fixed_x18 { + if sess.target.arch != "aarch64" { + sess.dcx().emit_fatal(errors::FixedX18InvalidArch { arch: &sess.target.arch }); + } else { + features.push("+reserve-x18".into()); + } + } } /// The list of LLVM features computed from CLI flags (`-Ctarget-cpu`, `-Ctarget-feature`, @@ -736,19 +745,10 @@ pub(crate) fn global_llvm_features( ) }, ); - - llvm_features_by_flags(sess, &mut features); } - // -Zfixed-x18 - // FIXME: merge with `llvm_features_by_flags`. - if sess.opts.unstable_opts.fixed_x18 { - if sess.target.arch != "aarch64" { - sess.dcx().emit_fatal(errors::FixedX18InvalidArch { arch: &sess.target.arch }); - } else { - features.push("+reserve-x18".into()); - } - } + // We add this in the "base target" so that these show up in `sess.unstable_target_features`. + llvm_features_by_flags(sess, &mut features); features } |
