diff options
| author | kulst <kulst@mailbox.org> | 2025-02-05 21:33:58 +0100 |
|---|---|---|
| committer | kulst <kulst@mailbox.org> | 2025-02-16 21:57:03 +0100 |
| commit | 831d9f39e9c330934b7c4f35010477ba4a738d96 (patch) | |
| tree | 025f8137a4b7b0140ef9850092dfe5157ecd0e4a /compiler/rustc_codegen_ssa | |
| parent | 2445dd794e4e24d62ab8d79ba8924baba44865ae (diff) | |
| download | rust-831d9f39e9c330934b7c4f35010477ba4a738d96.tar.gz rust-831d9f39e9c330934b7c4f35010477ba4a738d96.zip | |
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).
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/link.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 105a4cb81f0..dceef52e81a 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -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 { |
