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, TargetMetadata, TargetOptions, base,
14    cvs,
15};
16
17pub(crate) fn target() -> Target {
18    Target {
19        llvm_target: "thumbv4t-none-eabi".into(),
20        metadata: TargetMetadata {
21            description: Some("Thumb-mode Bare ARMv4T".into()),
22            tier: Some(3),
23            host_tools: Some(false),
24            std: Some(false),
25        },
26        pointer_width: 32,
27        arch: "arm".into(),
28        /* Data layout args are '-' separated:
29         * little endian
30         * stack is 64-bit aligned (EABI)
31         * pointers are 32-bit
32         * i64 must be 64-bit aligned (EABI)
33         * mangle names with ELF style
34         * native integers are 32-bit
35         * All other elements are default
36         */
37        data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
38        options: TargetOptions {
39            abi: "eabi".into(),
40            llvm_floatabi: Some(FloatAbi::Soft),
41
42            // extra args passed to the external assembler (assuming `arm-none-eabi-as`):
43            // * activate t32/a32 interworking
44            // * use arch ARMv4T
45            // * use little-endian
46            asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
47
48            // minimum extra features, these cannot be disabled via -C
49            // Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
50            // The resulting atomics are ABI incompatible with atomics backed by libatomic.
51            features: "+soft-float,+strict-align,+atomics-32".into(),
52
53            panic_strategy: PanicStrategy::Abort,
54            relocation_model: RelocModel::Static,
55            // suggested from thumb_base, rust-lang/rust#44993.
56            emit_debug_gdb_scripts: false,
57            frame_pointer: FramePointer::MayOmit,
58
59            main_needs_argc_argv: false,
60
61            // don't have atomic compare-and-swap
62            atomic_cas: false,
63            has_thumb_interworking: true,
64
65            ..base::thumb::opts()
66        },
67    }
68}