Skip to content

Commit

Permalink
Rollup merge of rust-lang#112179 - tamird:no-empty-cpu-features, r=pe…
Browse files Browse the repository at this point in the history
…trochenkov

Avoid passing --cpu-features when empty

Added in 12ac719, this logic always
passed --cpu-features, even when the value was the empty string.
  • Loading branch information
GuillaumeGomez authored Jun 8, 2023
2 parents e7059f1 + cd43545 commit ad9d7e3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2271,11 +2271,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();
Expand Down

0 comments on commit ad9d7e3

Please sign in to comment.