Skip to content

Commit cd43545

Browse files
committed
Avoid passing --cpu-features when empty
Added in 12ac719, this logic always passed --cpu-features, even when the value was the empty string.
1 parent 642c92e commit cd43545

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
@@ -2256,11 +2256,13 @@ fn add_order_independent_options(
22562256
} else if flavor == LinkerFlavor::Bpf {
22572257
cmd.arg("--cpu");
22582258
cmd.arg(&codegen_results.crate_info.target_cpu);
2259-
cmd.arg("--cpu-features");
2260-
cmd.arg(match &sess.opts.cg.target_feature {
2261-
feat if !feat.is_empty() => feat.as_ref(),
2262-
_ => sess.target.options.features.as_ref(),
2263-
});
2259+
if let Some(feat) = [sess.opts.cg.target_feature.as_str(), &sess.target.options.features]
2260+
.into_iter()
2261+
.find(|feat| !feat.is_empty())
2262+
{
2263+
cmd.arg("--cpu-features");
2264+
cmd.arg(feat);
2265+
}
22642266
}
22652267

22662268
cmd.linker_plugin_lto();

0 commit comments

Comments
 (0)