rustc_target/spec/targets/
riscv32e_unknown_none_elf.rs

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