]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_target/src/spec/msp430_none_elf.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / compiler / rustc_target / src / spec / msp430_none_elf.rs
1 use crate::spec::{LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, TargetResult};
2
3 pub fn target() -> TargetResult {
4 Ok(Target {
5 llvm_target: "msp430-none-elf".to_string(),
6 target_endian: "little".to_string(),
7 target_pointer_width: "16".to_string(),
8 target_c_int_width: "16".to_string(),
9 data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".to_string(),
10 arch: "msp430".to_string(),
11 target_os: "none".to_string(),
12 target_env: String::new(),
13 target_vendor: String::new(),
14 linker_flavor: LinkerFlavor::Gcc,
15
16 options: TargetOptions {
17 executables: true,
18
19 // The LLVM backend currently can't generate object files. To
20 // workaround this LLVM generates assembly files which then we feed
21 // to gcc to get object files. For this reason we have a hard
22 // dependency on this specific gcc.
23 asm_args: vec!["-mcpu=msp430".to_string()],
24 linker: Some("msp430-elf-gcc".to_string()),
25
26 // There are no atomic CAS instructions available in the MSP430
27 // instruction set, and the LLVM backend doesn't currently support
28 // compiler fences so the Atomic* API is missing on this target.
29 // When the LLVM backend gains support for compile fences uncomment
30 // the `singlethread: true` line and set `max_atomic_width` to
31 // `Some(16)`.
32 max_atomic_width: Some(0),
33 atomic_cas: false,
34 // singlethread: true,
35
36 // Because these devices have very little resources having an
37 // unwinder is too onerous so we default to "abort" because the
38 // "unwind" strategy is very rare.
39 panic_strategy: PanicStrategy::Abort,
40
41 // Similarly, one almost always never wants to use relocatable
42 // code because of the extra costs it involves.
43 relocation_model: RelocModel::Static,
44
45 // Right now we invoke an external assembler and this isn't
46 // compatible with multiple codegen units, and plus we probably
47 // don't want to invoke that many gcc instances.
48 default_codegen_units: Some(1),
49
50 // Since MSP430 doesn't meaningfully support faulting on illegal
51 // instructions, LLVM generates a call to abort() function instead
52 // of a trap instruction. Such calls are 4 bytes long, and that is
53 // too much overhead for such small target.
54 trap_unreachable: false,
55
56 // See the thumb_base.rs file for an explanation of this value
57 emit_debug_gdb_scripts: false,
58
59 eh_frame_header: false,
60
61 ..Default::default()
62 },
63 })
64 }