]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_target/src/spec/msp430_none_elf.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / compiler / rustc_target / src / spec / msp430_none_elf.rs
CommitLineData
2b03887a 1use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
041b39d2 2
29967ef6
XL
3pub fn target() -> Target {
4 Target {
5e7ed085 5 llvm_target: "msp430-none-elf".into(),
29967ef6 6 pointer_width: 16,
5e7ed085
FG
7 data_layout: "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16".into(),
8 arch: "msp430".into(),
041b39d2
XL
9
10 options: TargetOptions {
5e7ed085 11 c_int_width: "16".into(),
041b39d2
XL
12
13 // The LLVM backend currently can't generate object files. To
14 // workaround this LLVM generates assembly files which then we feed
15 // to gcc to get object files. For this reason we have a hard
16 // dependency on this specific gcc.
5e7ed085
FG
17 asm_args: cvs!["-mcpu=msp430"],
18 linker: Some("msp430-elf-gcc".into()),
2b03887a 19 linker_flavor: LinkerFlavor::Unix(Cc::Yes),
041b39d2 20
8faf50e0 21 // There are no atomic CAS instructions available in the MSP430
a1dfa0c6
XL
22 // instruction set, and the LLVM backend doesn't currently support
23 // compiler fences so the Atomic* API is missing on this target.
24 // When the LLVM backend gains support for compile fences uncomment
25 // the `singlethread: true` line and set `max_atomic_width` to
26 // `Some(16)`.
27 max_atomic_width: Some(0),
8faf50e0 28 atomic_cas: false,
a1dfa0c6 29 // singlethread: true,
041b39d2
XL
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.
f9f354fc 38 relocation_model: RelocModel::Static,
041b39d2 39
abe05a73
XL
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
2c00a5a8
XL
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
83c7162d
XL
51 // See the thumb_base.rs file for an explanation of this value
52 emit_debug_gdb_scripts: false,
53
f9652781
XL
54 eh_frame_header: false,
55
dfeec247
XL
56 ..Default::default()
57 },
29967ef6 58 }
041b39d2 59}