1 // Generic ARMv7-A target for bare-metal code - floating point disabled
3 // This is basically the `armv7-unknown-linux-gnueabi` target with some changes
4 // (listed below) to bring it closer to the bare-metal `thumb` & `aarch64`
7 // - `TargetOptions.features`: added `+strict-align`. rationale: unaligned
8 // memory access is disabled on boot on these cores
9 // - linker changed to LLD. rationale: C is not strictly needed to build
10 // bare-metal binaries (the `gcc` linker has the advantage that it knows where C
11 // libraries and crt*.o are but it's not much of an advantage here); LLD is also
13 // - `panic_strategy` set to `abort`. rationale: matches `thumb` targets
14 // - `relocation-model` set to `static`; also no PIE, no relro and no dynamic
15 // linking. rationale: matches `thumb` targets
17 use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
19 pub fn target() -> Target {
20 let opts = TargetOptions {
22 linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
23 linker: Some("rust-lld".into()),
24 features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),
26 relocation_model: RelocModel::Static,
27 disable_redzone: true,
28 max_atomic_width: Some(64),
29 panic_strategy: PanicStrategy::Abort,
30 emit_debug_gdb_scripts: false,
35 llvm_target: "armv7a-none-eabi".into(),
37 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),