rustc_target/spec/targets/armv7a_none_eabi.rs
1// Generic ARMv7-A target for bare-metal code - floating point disabled
2//
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`
5// targets:
6//
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
12// faster
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
16
17use crate::spec::{
18 Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions,
19};
20
21pub(crate) fn target() -> Target {
22 let opts = TargetOptions {
23 abi: "eabi".into(),
24 llvm_floatabi: Some(FloatAbi::Soft),
25 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
26 linker: Some("rust-lld".into()),
27 features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),
28 relocation_model: RelocModel::Static,
29 disable_redzone: true,
30 max_atomic_width: Some(64),
31 panic_strategy: PanicStrategy::Abort,
32 emit_debug_gdb_scripts: false,
33 c_enum_min_bits: Some(8),
34 ..Default::default()
35 };
36 Target {
37 llvm_target: "armv7a-none-eabi".into(),
38 metadata: crate::spec::TargetMetadata {
39 description: Some("Bare Armv7-A".into()),
40 tier: Some(2),
41 host_tools: Some(false),
42 std: Some(false),
43 },
44 pointer_width: 32,
45 data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
46 arch: "arm".into(),
47 options: opts,
48 }
49}