]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/thumbv4t_none_eabi.rs
Update targets to use target_abi
[rust.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 (specifically the linker, `arm-none-eabi-ld`). They can be obtained for free for all major OSes from the ARM developer's website, and they may also be available in your system's package manager. Unfortunately, the standard linker that Rust uses (`lld`) only supports as far back as `ARMv5TE`, so we must use the GNU `ld` linker.
8 //!
9 //! **Important:** This target profile **does not** specify a linker script. You just get the default link script when you build a binary for this target. The default link script is very likely wrong, so you should use `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
10
11 use crate::spec::{LinkerFlavor, Target, TargetOptions};
12
13 pub fn target() -> Target {
14     Target {
15         llvm_target: "thumbv4t-none-eabi".to_string(),
16         pointer_width: 32,
17         arch: "arm".to_string(),
18         /* Data layout args are '-' separated:
19          * little endian
20          * stack is 64-bit aligned (EABI)
21          * pointers are 32-bit
22          * i64 must be 64-bit aligned (EABI)
23          * mangle names with ELF style
24          * native integers are 32-bit
25          * All other elements are default
26          */
27         data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
28         options: TargetOptions {
29             abi: "eabi".to_string(),
30             linker_flavor: LinkerFlavor::Ld,
31             linker: Some("arm-none-eabi-ld".to_string()),
32
33             // extra args passed to the external assembler (assuming `arm-none-eabi-as`):
34             // * activate t32/a32 interworking
35             // * use arch ARMv4T
36             // * use little-endian
37             asm_args: vec![
38                 "-mthumb-interwork".to_string(),
39                 "-march=armv4t".to_string(),
40                 "-mlittle-endian".to_string(),
41             ],
42
43             // minimum extra features, these cannot be disabled via -C
44             features: "+soft-float,+strict-align".to_string(),
45
46             main_needs_argc_argv: false,
47
48             // don't have atomic compare-and-swap
49             atomic_cas: false,
50             has_thumb_interworking: true,
51
52             ..super::thumb_base::opts()
53         },
54     }
55 }