]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_target/src/spec/riscv32imc_esp_espidf.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / compiler / rustc_target / src / spec / riscv32imc_esp_espidf.rs
1 use crate::spec::{cvs, Target, TargetOptions};
2 use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel};
3
4 pub fn target() -> Target {
5 Target {
6 data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
7 llvm_target: "riscv32".into(),
8 pointer_width: 32,
9 arch: "riscv32".into(),
10
11 options: TargetOptions {
12 families: cvs!["unix"],
13 os: "espidf".into(),
14 env: "newlib".into(),
15 vendor: "espressif".into(),
16 linker_flavor: LinkerFlavor::Gcc,
17 linker: Some("riscv32-esp-elf-gcc".into()),
18 cpu: "generic-rv32".into(),
19
20 // While the RiscV32IMC architecture does not natively support atomics, ESP-IDF does support
21 // the __atomic* and __sync* GCC builtins, so setting `max_atomic_width` to `Some(64)`
22 // and `atomic_cas` to `true` will cause the compiler to emit libcalls to these builtins.
23 //
24 // Support for atomics is necessary for the Rust STD library, which is supported by the ESP-IDF framework.
25 max_atomic_width: Some(64),
26 atomic_cas: true,
27
28 features: "+m,+c".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 }