]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/spec/armv7a_none_eabi.rs
Auto merge of #97800 - pnkfelix:issue-97463-fix-aarch64-call-abi-does-not-zeroext...
[rust.git] / compiler / rustc_target / src / spec / 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
17 use super::{LinkerFlavor, LldFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
18
19 pub fn target() -> Target {
20     let opts = TargetOptions {
21         abi: "eabi".into(),
22         linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
23         linker: Some("rust-lld".into()),
24         features: "+v7,+thumb2,+soft-float,-neon,+strict-align".into(),
25         relocation_model: RelocModel::Static,
26         disable_redzone: true,
27         max_atomic_width: Some(64),
28         panic_strategy: PanicStrategy::Abort,
29         emit_debug_gdb_scripts: false,
30         c_enum_min_bits: 8,
31         ..Default::default()
32     };
33     Target {
34         llvm_target: "armv7a-none-eabi".into(),
35         pointer_width: 32,
36         data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
37         arch: "arm".into(),
38         options: opts,
39     }
40 }