]> git.proxmox.com Git - rustc.git/blame - src/librustc_target/spec/thumbv4t_none_eabi.rs
New upstream version 1.47.0+dfsg1
[rustc.git] / src / librustc_target / 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//!
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
11use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
12
13pub fn target() -> TargetResult {
14 Ok(Target {
15 llvm_target: "thumbv4t-none-eabi".to_string(),
16 target_endian: "little".to_string(),
17 target_pointer_width: "32".to_string(),
18 target_c_int_width: "32".to_string(),
19 target_os: "none".to_string(),
20 target_env: "".to_string(),
21 target_vendor: "".to_string(),
22 arch: "arm".to_string(),
23 /* Data layout args are '-' separated:
24 * little endian
25 * stack is 64-bit aligned (EABI)
26 * pointers are 32-bit
27 * i64 must be 64-bit aligned (EABI)
28 * mangle names with ELF style
29 * native integers are 32-bit
30 * All other elements are default
31 */
32 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".to_string(),
33 linker_flavor: LinkerFlavor::Ld,
34 options: TargetOptions {
35 linker: Some("arm-none-eabi-ld".to_string()),
36 linker_is_gnu: true,
37
38 // extra args passed to the external assembler (assuming `arm-none-eabi-as`):
39 // * activate t32/a32 interworking
40 // * use arch ARMv4T
41 // * use little-endian
42 asm_args: vec![
43 "-mthumb-interwork".to_string(),
44 "-march=armv4t".to_string(),
45 "-mlittle-endian".to_string(),
46 ],
47
48 // minimum extra features, these cannot be disabled via -C
49 features: "+soft-float,+strict-align".to_string(),
50
51 main_needs_argc_argv: false,
52
53 // No thread-local storage (just use a static Cell)
54 has_elf_tls: false,
55
56 // don't have atomic compare-and-swap
57 atomic_cas: false,
58
59 ..super::thumb_base::opts()
60 },
61 })
62}