]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/nvptx64_nvidia_cuda.rs
Auto merge of #97800 - pnkfelix:issue-97463-fix-aarch64-call-abi-does-not-zeroext...
[rust.git] / compiler / rustc_target / src / spec / nvptx64_nvidia_cuda.rs
1 use crate::spec::{LinkerFlavor, MergeFunctions, PanicStrategy, Target, TargetOptions};
2
3 pub fn target() -> Target {
4     Target {
5         arch: "nvptx64".into(),
6         data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".into(),
7         llvm_target: "nvptx64-nvidia-cuda".into(),
8         pointer_width: 64,
9
10         options: TargetOptions {
11             os: "cuda".into(),
12             vendor: "nvidia".into(),
13             linker_flavor: LinkerFlavor::Ptx,
14             // The linker can be installed from `crates.io`.
15             linker: Some("rust-ptx-linker".into()),
16             linker_is_gnu: false,
17
18             // With `ptx-linker` approach, it can be later overridden via link flags.
19             cpu: "sm_30".into(),
20
21             // FIXME: create tests for the atomics.
22             max_atomic_width: Some(64),
23
24             // Unwinding on CUDA is neither feasible nor useful.
25             panic_strategy: PanicStrategy::Abort,
26
27             // Needed to use `dylib` and `bin` crate types and the linker.
28             dynamic_linking: true,
29
30             // Avoid using dylib because it contain metadata not supported
31             // by LLVM NVPTX backend.
32             only_cdylib: true,
33
34             // Let the `ptx-linker` to handle LLVM lowering into MC / assembly.
35             obj_is_bitcode: true,
36
37             // Convenient and predicable naming scheme.
38             dll_prefix: "".into(),
39             dll_suffix: ".ptx".into(),
40             exe_suffix: ".ptx".into(),
41
42             // Disable MergeFunctions LLVM optimisation pass because it can
43             // produce kernel functions that call other kernel functions.
44             // This behavior is not supported by PTX ISA.
45             merge_functions: MergeFunctions::Disabled,
46
47             // The LLVM backend does not support stack canaries for this target
48             supports_stack_protector: false,
49
50             ..Default::default()
51         },
52     }
53 }