rustc_target/spec/targets/
amdgcn_amd_amdhsa.rs

1use crate::spec::{
2    Arch, Cc, LinkerFlavor, Lld, PanicStrategy, Target, TargetMetadata, TargetOptions,
3};
4
5pub(crate) fn target() -> Target {
6    Target {
7        arch: Arch::AmdGpu,
8        data_layout: "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9".into(),
9        llvm_target: "amdgcn-amd-amdhsa".into(),
10        metadata: TargetMetadata {
11            description: Some("AMD GPU".into()),
12            tier: Some(3),
13            host_tools: Some(false),
14            std: Some(false),
15        },
16        pointer_width: 64,
17
18        options: TargetOptions {
19            os: "amdhsa".into(),
20            vendor: "amd".into(),
21            linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
22            linker: Some("rust-lld".into()),
23
24            // There are many CPUs, one for each hardware generation.
25            // Require to set one explicitly as there is no good default.
26            need_explicit_cpu: true,
27
28            max_atomic_width: Some(64),
29
30            // Unwinding on GPUs is not useful.
31            panic_strategy: PanicStrategy::Abort,
32
33            // amdgpu backend does not support libcalls.
34            no_builtins: true,
35            simd_types_indirect: false,
36
37            // Clearly a GPU
38            is_like_gpu: true,
39
40            // Allow `cdylib` crate type.
41            dynamic_linking: true,
42            only_cdylib: true,
43            executables: false,
44            dll_prefix: "".into(),
45            dll_suffix: ".elf".into(),
46
47            // The LLVM backend does not support stack canaries for this target
48            supports_stack_protector: false,
49
50            // Force LTO, object linking does not yet work with amdgpu.
51            requires_lto: true,
52
53            ..Default::default()
54        },
55    }
56}