|
| 1 | +//! Targets the ARMv4T, with code as `a32` 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::{cvs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions}; |
| 20 | + |
| 21 | +pub fn target() -> Target { |
| 22 | + Target { |
| 23 | + llvm_target: "armv4t-none-eabi".into(), |
| 24 | + pointer_width: 32, |
| 25 | + arch: "arm".into(), |
| 26 | + /* Data layout args are '-' separated: |
| 27 | + * little endian |
| 28 | + * stack is 64-bit aligned (EABI) |
| 29 | + * pointers are 32-bit |
| 30 | + * i64 must be 64-bit aligned (EABI) |
| 31 | + * mangle names with ELF style |
| 32 | + * native integers are 32-bit |
| 33 | + * All other elements are default |
| 34 | + */ |
| 35 | + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), |
| 36 | + options: TargetOptions { |
| 37 | + abi: "eabi".into(), |
| 38 | + linker_flavor: LinkerFlavor::Ld, |
| 39 | + linker: Some("arm-none-eabi-ld".into()), |
| 40 | + asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",], |
| 41 | + features: "+soft-float,+strict-align".into(), |
| 42 | + main_needs_argc_argv: false, |
| 43 | + atomic_cas: false, |
| 44 | + has_thumb_interworking: true, |
| 45 | + relocation_model: RelocModel::Static, |
| 46 | + panic_strategy: PanicStrategy::Abort, |
| 47 | + // from thumb_base, rust-lang/rust#44993. |
| 48 | + emit_debug_gdb_scripts: false, |
| 49 | + // from thumb_base, apparently gcc/clang give enums a minimum of 8 bits on no-os targets |
| 50 | + c_enum_min_bits: 8, |
| 51 | + ..Default::default() |
| 52 | + }, |
| 53 | + } |
| 54 | +} |
0 commit comments