Skip to content

Commit ad9d7e3

Browse files
Rollup merge of #112179 - tamird:no-empty-cpu-features, r=petrochenkov
Avoid passing --cpu-features when empty Added in 12ac719, this logic always passed --cpu-features, even when the value was the empty string.
2 parents e7059f1 + cd43545 commit ad9d7e3

File tree

1 file changed

+7
-5
lines changed
  • compiler/rustc_codegen_ssa/src/back

1 file changed

+7
-5
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -2271,11 +2271,13 @@ fn add_order_independent_options(
22712271
} else if flavor == LinkerFlavor::Bpf {
22722272
cmd.arg("--cpu");
22732273
cmd.arg(&codegen_results.crate_info.target_cpu);
2274-
cmd.arg("--cpu-features");
2275-
cmd.arg(match &sess.opts.cg.target_feature {
2276-
feat if !feat.is_empty() => feat.as_ref(),
2277-
_ => sess.target.options.features.as_ref(),
2278-
});
2274+
if let Some(feat) = [sess.opts.cg.target_feature.as_str(), &sess.target.options.features]
2275+
.into_iter()
2276+
.find(|feat| !feat.is_empty())
2277+
{
2278+
cmd.arg("--cpu-features");
2279+
cmd.arg(feat);
2280+
}
22792281
}
22802282

22812283
cmd.linker_plugin_lto();

0 commit comments

Comments
 (0)