1
Fork 0

Pass through of target features to llvm-bitcode-linker and handling them

The .ptx version produced by llc can be specified by passing it with --mattr. Currently it is not possible to specify the .ptx version with -Ctarget-feature because these are not passed through to llvm-bitcode-linker and handled by it. This commit adds both.
--target-feature and -mattr are passed with equals to mitigate issues when the value starts with a - (minus).
This commit is contained in:
kulst 2025-02-05 21:33:58 +01:00
parent 2445dd794e
commit 831d9f39e9
3 changed files with 23 additions and 2 deletions

View file

@ -2518,6 +2518,12 @@ fn add_order_independent_options(
"--target-cpu",
&codegen_results.crate_info.target_cpu,
]);
if codegen_results.crate_info.target_features.len() > 0 {
cmd.link_arg(&format!(
"--target-feature={}",
&codegen_results.crate_info.target_features.join(",")
));
}
} else if flavor == LinkerFlavor::Ptx {
cmd.link_args(&["--fallback-arch", &codegen_results.crate_info.target_cpu]);
} else if flavor == LinkerFlavor::Bpf {