rustc_target/spec/targets/
thumbv4t_none_eabi.rs

1//! Targets the ARMv4T, with code as `t32` code by default.
2//!
3//! Primarily of use for the GBA, but usable with other devices too.
4//!
5//! Please ping @Lokathor if changes are needed.
6//!
7//! **Important:** This target profile **does not** specify a linker script. You
8//! just get the default link script when you build a binary for this target.
9//! The default link script is very likely wrong, so you should use
10//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
11
12use crate::spec::{
13    FloatAbi, FramePointer, PanicStrategy, RelocModel, Target, TargetOptions, base, cvs,
14};
15
16pub(crate) fn target() -> Target {
17    Target {
18        llvm_target: "thumbv4t-none-eabi".into(),
19        metadata: crate::spec::TargetMetadata {
20            description: Some("Thumb-mode Bare ARMv4T".into()),
21            tier: Some(3),
22            host_tools: Some(false),
23            std: Some(false),
24        },
25        pointer_width: 32,
26        arch: "arm".into(),
27        /* Data layout args are '-' separated:
28         * little endian
29         * stack is 64-bit aligned (EABI)
30         * pointers are 32-bit
31         * i64 must be 64-bit aligned (EABI)
32         * mangle names with ELF style
33         * native integers are 32-bit
34         * All other elements are default
35         */
36        data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
37        options: TargetOptions {
38            abi: "eabi".into(),
39            llvm_floatabi: Some(FloatAbi::Soft),
40
41            // extra args passed to the external assembler (assuming `arm-none-eabi-as`):
42            // * activate t32/a32 interworking
43            // * use arch ARMv4T
44            // * use little-endian
45            asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
46
47            // minimum extra features, these cannot be disabled via -C
48            // Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
49            // The resulting atomics are ABI incompatible with atomics backed by libatomic.
50            features: "+soft-float,+strict-align,+atomics-32".into(),
51
52            panic_strategy: PanicStrategy::Abort,
53            relocation_model: RelocModel::Static,
54            // suggested from thumb_base, rust-lang/rust#44993.
55            emit_debug_gdb_scripts: false,
56            frame_pointer: FramePointer::MayOmit,
57
58            main_needs_argc_argv: false,
59
60            // don't have atomic compare-and-swap
61            atomic_cas: false,
62            has_thumb_interworking: true,
63
64            ..base::thumb::opts()
65        },
66    }
67}