]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs
New upstream version 1.65.0+dfsg1
[rustc.git] / compiler / rustc_target / src / spec / 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 //! 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.
13 //!
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.
18
19 use crate::spec::{
20 cvs, FramePointer, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions,
21 };
22
23 pub fn target() -> Target {
24 Target {
25 llvm_target: "thumbv4t-none-eabi".into(),
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 linker_flavor: LinkerFlavor::Ld,
41 linker: Some("arm-none-eabi-ld".into()),
42
43 // extra args passed to the external assembler (assuming `arm-none-eabi-as`):
44 // * activate t32/a32 interworking
45 // * use arch ARMv4T
46 // * use little-endian
47 asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
48
49 // minimum extra features, these cannot be disabled via -C
50 // Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
51 // The resulting atomics are ABI incompatible with atomics backed by libatomic.
52 features: "+soft-float,+strict-align,+atomics-32".into(),
53
54 panic_strategy: PanicStrategy::Abort,
55 relocation_model: RelocModel::Static,
56 // suggested from thumb_base, rust-lang/rust#44993.
57 emit_debug_gdb_scripts: false,
58 // suggested from thumb_base, with no-os gcc/clang use 8-bit enums
59 c_enum_min_bits: 8,
60 frame_pointer: FramePointer::MayOmit,
61
62 main_needs_argc_argv: false,
63
64 // don't have atomic compare-and-swap
65 atomic_cas: false,
66 has_thumb_interworking: true,
67
68 ..super::thumb_base::opts()
69 },
70 }
71 }