1 | use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, Target, TargetMetadata, TargetOptions}; |
---|---|
2 | |
3 | pub(crate) fn target() -> Target { |
4 | Target { |
5 | arch: "amdgpu".into(), |
6 | 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-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(), |
7 | llvm_target: "amdgcn-amd-amdhsa".into(), |
8 | metadata: TargetMetadata { |
9 | description: Some("AMD GPU".into()), |
10 | tier: Some(3), |
11 | host_tools: Some(false), |
12 | std: Some(false), |
13 | }, |
14 | pointer_width: 64, |
15 | |
16 | options: TargetOptions { |
17 | os: "amdhsa".into(), |
18 | vendor: "amd".into(), |
19 | linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes), |
20 | linker: Some("rust-lld".into()), |
21 | |
22 | // There are many CPUs, one for each hardware generation. |
23 | // Require to set one explicitly as there is no good default. |
24 | need_explicit_cpu: true, |
25 | |
26 | max_atomic_width: Some(64), |
27 | |
28 | // Unwinding on GPUs is not useful. |
29 | panic_strategy: PanicStrategy::Abort, |
30 | |
31 | // amdgpu backend does not support libcalls. |
32 | no_builtins: true, |
33 | simd_types_indirect: false, |
34 | |
35 | // Allow `cdylib` crate type. |
36 | dynamic_linking: true, |
37 | only_cdylib: true, |
38 | executables: false, |
39 | dll_prefix: "".into(), |
40 | dll_suffix: ".elf".into(), |
41 | |
42 | // The LLVM backend does not support stack canaries for this target |
43 | supports_stack_protector: false, |
44 | |
45 | // Force LTO, object linking does not yet work with amdgpu. |
46 | requires_lto: true, |
47 | |
48 | ..Default::default() |
49 | }, |
50 | } |
51 | } |
52 |
Definitions
Learn Rust with the experts
Find out more