Rollup merge of #112179 - tamird:no-empty-cpu-features, r=petrochenkov

Avoid passing --cpu-features when empty

Added in 12ac719b99560072cbe52a957f22d3fe6946cf2a, this logic always
passed --cpu-features, even when the value was the empty string.
This commit is contained in:
Guillaume Gomez 2023-06-08 10:15:09 +02:00 committed by GitHub
commit ad9d7e3ed5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2271,11 +2271,13 @@ fn add_order_independent_options(
} else if flavor == LinkerFlavor::Bpf { } else if flavor == LinkerFlavor::Bpf {
cmd.arg("--cpu"); cmd.arg("--cpu");
cmd.arg(&codegen_results.crate_info.target_cpu); cmd.arg(&codegen_results.crate_info.target_cpu);
cmd.arg("--cpu-features"); if let Some(feat) = [sess.opts.cg.target_feature.as_str(), &sess.target.options.features]
cmd.arg(match &sess.opts.cg.target_feature { .into_iter()
feat if !feat.is_empty() => feat.as_ref(), .find(|feat| !feat.is_empty())
_ => sess.target.options.features.as_ref(), {
}); cmd.arg("--cpu-features");
cmd.arg(feat);
}
} }
cmd.linker_plugin_lto(); cmd.linker_plugin_lto();