|
| 1 | +use crate::spec::{LinkerFlavor, PanicStrategy, Target, TargetOptions, TargetResult, abi::Abi}; |
| 2 | +// use crate::spec::abi::Abi; |
| 3 | + |
| 4 | +pub fn target() -> TargetResult { |
| 5 | + Ok(Target { |
| 6 | + llvm_target: "xtensa-none-elf".to_string(), |
| 7 | + target_endian: "little".to_string(), |
| 8 | + target_pointer_width: "32".to_string(), |
| 9 | + target_c_int_width: "32".to_string(), |
| 10 | + data_layout: "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-f64:64-a:0:32-n32".to_string(), |
| 11 | + arch: "xtensa".to_string(), |
| 12 | + target_os: "none".to_string(), |
| 13 | + target_env: String::new(), |
| 14 | + target_vendor: String::new(), |
| 15 | + linker_flavor: LinkerFlavor::Gcc, |
| 16 | + |
| 17 | + options: TargetOptions { |
| 18 | + executables: true, |
| 19 | + cpu: "esp8266".to_string(), |
| 20 | + // The LLVM backend currently can't generate object files. To |
| 21 | + // workaround this LLVM generates assembly files which then we feed |
| 22 | + // to gcc to get object files. For this reason we have a hard |
| 23 | + // dependency on this specific gcc. |
| 24 | + // asm_args: vec!["-mcpu=esp8266".to_string()], |
| 25 | + linker: Some("xtensa-esp32-elf-gcc".to_string()), |
| 26 | + no_integrated_as: true, |
| 27 | + |
| 28 | + max_atomic_width: Some(32), |
| 29 | + atomic_cas: true, |
| 30 | + |
| 31 | + // Because these devices have very little resources having an |
| 32 | + // unwinder is too onerous so we default to "abort" because the |
| 33 | + // "unwind" strategy is very rare. |
| 34 | + panic_strategy: PanicStrategy::Abort, |
| 35 | + |
| 36 | + // Similarly, one almost always never wants to use relocatable |
| 37 | + // code because of the extra costs it involves. |
| 38 | + relocation_model: "static".to_string(), |
| 39 | + |
| 40 | + // Right now we invoke an external assembler and this isn't |
| 41 | + // compatible with multiple codegen units, and plus we probably |
| 42 | + // don't want to invoke that many gcc instances. |
| 43 | + default_codegen_units: Some(1), |
| 44 | + |
| 45 | + // Since MSP430 doesn't meaningfully support faulting on illegal |
| 46 | + // instructions, LLVM generates a call to abort() function instead |
| 47 | + // of a trap instruction. Such calls are 4 bytes long, and that is |
| 48 | + // too much overhead for such small target. |
| 49 | + trap_unreachable: false, |
| 50 | + |
| 51 | + // See the thumb_base.rs file for an explanation of this value |
| 52 | + emit_debug_gdb_scripts: false, |
| 53 | + |
| 54 | + abi_blacklist: vec![ |
| 55 | + Abi::Stdcall, |
| 56 | + Abi::Fastcall, |
| 57 | + Abi::Vectorcall, |
| 58 | + Abi::Thiscall, |
| 59 | + Abi::Win64, |
| 60 | + Abi::SysV64, |
| 61 | + ], |
| 62 | + |
| 63 | + .. Default::default( ) |
| 64 | + } |
| 65 | + }) |
| 66 | +} |
0 commit comments