diff options
| author | Tamir Duberstein <tamird@gmail.com> | 2023-06-01 13:07:51 -0400 |
|---|---|---|
| committer | Tamir Duberstein <tamird@gmail.com> | 2023-06-01 13:07:51 -0400 |
| commit | cd4354578a9a8cae62d9340eda66ec6689ac8ba7 (patch) | |
| tree | 40f5cd3d3bf84e781b2322b56326a5e0a6433506 | |
| parent | 642c92e63008ffb49f6ad8344e07bfa7d5b0d9bb (diff) | |
| download | rust-cd4354578a9a8cae62d9340eda66ec6689ac8ba7.tar.gz rust-cd4354578a9a8cae62d9340eda66ec6689ac8ba7.zip | |
Avoid passing --cpu-features when empty
Added in 12ac719b99560072cbe52a957f22d3fe6946cf2a, this logic always passed --cpu-features, even when the value was the empty string.
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index f8bb9bf2bb5..8dbd4456a6b 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2256,11 +2256,13 @@ fn add_order_independent_options( } else if flavor == LinkerFlavor::Bpf { cmd.arg("--cpu"); cmd.arg(&codegen_results.crate_info.target_cpu); - cmd.arg("--cpu-features"); - cmd.arg(match &sess.opts.cg.target_feature { - feat if !feat.is_empty() => feat.as_ref(), - _ => sess.target.options.features.as_ref(), - }); + if let Some(feat) = [sess.opts.cg.target_feature.as_str(), &sess.target.options.features] + .into_iter() + .find(|feat| !feat.is_empty()) + { + cmd.arg("--cpu-features"); + cmd.arg(feat); + } } cmd.linker_plugin_lto(); |
