rustc_target/spec/targets/
riscv32emc_unknown_none_elf.rs

1use crate::spec::{
2    Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
3};
4
5pub(crate) fn target() -> Target {
6    let abi = "ilp32e";
7    Target {
8        // The below `data_layout` is explicitly specified by the ilp32e ABI in LLVM. See also
9        // `options.llvm_abiname`.
10        data_layout: "e-m:e-p:32:32-i64:64-n32-S32".into(),
11        llvm_target: "riscv32".into(),
12        metadata: TargetMetadata {
13            description: Some("Bare RISC-V (RV32EMC ISA)".into()),
14            tier: Some(3),
15            host_tools: Some(false),
16            std: Some(false),
17        },
18        pointer_width: 32,
19        arch: "riscv32".into(),
20
21        options: TargetOptions {
22            abi: abi.into(),
23            linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
24            linker: Some("rust-lld".into()),
25            cpu: "generic-rv32".into(),
26            // The ilp32e ABI specifies the `data_layout`
27            llvm_abiname: abi.into(),
28            max_atomic_width: Some(32),
29            atomic_cas: false,
30            features: "+e,+m,+c,+forced-atomics".into(),
31            panic_strategy: PanicStrategy::Abort,
32            relocation_model: RelocModel::Static,
33            emit_debug_gdb_scripts: false,
34            eh_frame_header: false,
35            ..Default::default()
36        },
37    }
38}