]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / compiler / rustc_target / src / spec / thumbv4t_none_eabi.rs
CommitLineData
3dfed10e
XL
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//!
064997fb
FG
7//! This target profile assumes that you have the ARM binutils in your path
8//! (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free
9//! for all major OSes from the ARM developer's website, and they may also be
10//! available in your system's package manager. Unfortunately, the standard
11//! linker that Rust uses (`lld`) only supports as far back as `ARMv5TE`, so we
12//! must use the GNU `ld` linker.
3dfed10e 13//!
064997fb
FG
14//! **Important:** This target profile **does not** specify a linker script. You
15//! just get the default link script when you build a binary for this target.
16//! The default link script is very likely wrong, so you should use
17//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
3dfed10e 18
2b03887a
FG
19use crate::spec::{cvs, Cc, FramePointer, LinkerFlavor, Lld};
20use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions};
3dfed10e 21
29967ef6
XL
22pub fn target() -> Target {
23 Target {
5e7ed085 24 llvm_target: "thumbv4t-none-eabi".into(),
29967ef6 25 pointer_width: 32,
5e7ed085 26 arch: "arm".into(),
3dfed10e
XL
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 */
5e7ed085 36 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
3dfed10e 37 options: TargetOptions {
5e7ed085 38 abi: "eabi".into(),
2b03887a 39 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::No),
5e7ed085 40 linker: Some("arm-none-eabi-ld".into()),
3dfed10e
XL
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
5e7ed085 46 asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
3dfed10e
XL
47
48 // minimum extra features, these cannot be disabled via -C
f2b60f7d
FG
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(),
3dfed10e 52
064997fb
FG
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 // suggested from thumb_base, with no-os gcc/clang use 8-bit enums
9ffffee4 58 c_enum_min_bits: Some(8),
064997fb
FG
59 frame_pointer: FramePointer::MayOmit,
60
3dfed10e
XL
61 main_needs_argc_argv: false,
62
3dfed10e
XL
63 // don't have atomic compare-and-swap
64 atomic_cas: false,
29967ef6 65 has_thumb_interworking: true,
3dfed10e
XL
66
67 ..super::thumb_base::opts()
68 },
29967ef6 69 }
3dfed10e 70}