Skip to content

Commit 1e3129f

Browse files
committed
Auto merge of #149351 - Zalathar:rollup-ee06zha, r=Zalathar
Rollup of 12 pull requests Successful merges: - rust-lang/rust#147936 (Offload intrinsic) - rust-lang/rust#148358 (Fix some issues around `rustc_public`) - rust-lang/rust#148452 (Mangle symbols with a mangled name close to PDB limits with v0 instead of legacy mangling to avoid linker errors) - rust-lang/rust#148751 (Build gnullvm toolchains on Windows natively) - rust-lang/rust#148951 (rustc_target: aarch64: Remove deprecated FEAT_TME) - rust-lang/rust#149149 ([rustdoc] misc search index cleanups) - rust-lang/rust#149173 (Use rust rather than LLVM target features in the target spec) - rust-lang/rust#149307 (Deny const auto traits) - rust-lang/rust#149312 (Mark riscv64gc-unknown-linux-musl as tier 2 target) - rust-lang/rust#149317 (Handle inline asm in has_ffi_unwind_calls) - rust-lang/rust#149326 (Remove unused `Clone` derive on `DelayedLint`) - rust-lang/rust#149341 (Add `Copy` to some AST enums.) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 817e6be + df655d2 commit 1e3129f

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/gcc_util.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
3333
// should be taken in cases like these.
3434
let mut features = vec![];
3535

36-
// Features implied by an implicit or explicit `--target`.
37-
features.extend(sess.target.features.split(',').filter(|v| !v.is_empty()).map(String::from));
38-
39-
// -Ctarget-features
40-
target_features::flag_to_backend_features(sess, |feature, enable| {
36+
let mut extend_backend_features = |feature: &str, enable: bool| {
4137
// We run through `to_gcc_features` when
4238
// passing requests down to GCC. This means that all in-language
4339
// features also work on the command line instead of having two
@@ -48,7 +44,13 @@ pub(crate) fn global_gcc_features(sess: &Session) -> Vec<String> {
4844
.flat_map(|feat| to_gcc_features(sess, feat).into_iter())
4945
.map(|feature| if !enable { format!("-{}", feature) } else { feature.to_string() }),
5046
);
51-
});
47+
};
48+
49+
// Features implied by an implicit or explicit `--target`.
50+
target_features::target_spec_to_backend_features(sess, &mut extend_backend_features);
51+
52+
// -Ctarget-features
53+
target_features::flag_to_backend_features(sess, extend_backend_features);
5254

5355
gcc_features_by_flags(sess, &mut features);
5456

@@ -66,6 +68,7 @@ pub fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]>
6668
(&Arch::X86 | &Arch::X86_64, "rdrand") => smallvec!["rdrnd"],
6769
(&Arch::X86 | &Arch::X86_64, "bmi1") => smallvec!["bmi"],
6870
(&Arch::X86 | &Arch::X86_64, "cmpxchg16b") => smallvec!["cx16"],
71+
(&Arch::X86 | &Arch::X86_64, "lahfsahf") => smallvec!["sahf"],
6972
(&Arch::X86 | &Arch::X86_64, "avx512vaes") => smallvec!["vaes"],
7073
(&Arch::X86 | &Arch::X86_64, "avx512gfni") => smallvec!["gfni"],
7174
(&Arch::X86 | &Arch::X86_64, "avx512vpclmulqdq") => smallvec!["vpclmulqdq"],

0 commit comments

Comments
 (0)