rustc_target/spec/targets/
aarch64_unknown_none.rs

1// Generic AArch64 target for bare-metal code - Floating point enabled
2//
3// Can be used in conjunction with the `target-feature` and
4// `target-cpu` compiler flags to opt-in more hardware-specific
5// features.
6//
7// For example, `-C target-cpu=cortex-a53`.
8
9use crate::spec::{
10    Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, StackProbeType, Target,
11    TargetMetadata, TargetOptions,
12};
13
14pub(crate) fn target() -> Target {
15    let opts = TargetOptions {
16        linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
17        linker: Some("rust-lld".into()),
18        // Enable the Cortex-A53 errata 843419 mitigation by default
19        pre_link_args: TargetOptions::link_args(
20            LinkerFlavor::Gnu(Cc::No, Lld::No),
21            &["--fix-cortex-a53-843419"],
22        ),
23        features: "+v8a,+strict-align,+neon".into(),
24        supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
25        relocation_model: RelocModel::Static,
26        disable_redzone: true,
27        max_atomic_width: Some(128),
28        stack_probes: StackProbeType::Inline,
29        panic_strategy: PanicStrategy::Abort,
30        default_uwtable: true,
31        ..Default::default()
32    };
33    Target {
34        llvm_target: "aarch64-unknown-none".into(),
35        metadata: TargetMetadata {
36            description: Some("Bare ARM64, hardfloat".into()),
37            tier: Some(2),
38            host_tools: Some(false),
39            std: Some(false),
40        },
41        pointer_width: 64,
42        data_layout: "e-m:e-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
43        arch: Arch::AArch64,
44        options: opts,
45    }
46}