| 
 | 1 | +// Generic AArch64 target for bare-metal code - Floating point disabled  | 
 | 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 | + | 
 | 9 | +use super::{LldFlavor, LinkerFlavor, Target, TargetOptions, PanicStrategy};  | 
 | 10 | + | 
 | 11 | +pub fn target() -> Result<Target, String> {  | 
 | 12 | +    let opts = TargetOptions {  | 
 | 13 | +        linker: Some("rust-lld".to_owned()),  | 
 | 14 | +        features: "+strict-align,-neon,-fp-armv8".to_string(),  | 
 | 15 | +        executables: true,  | 
 | 16 | +        relocation_model: "static".to_string(),  | 
 | 17 | +        disable_redzone: true,  | 
 | 18 | +        linker_is_gnu: true,  | 
 | 19 | +        max_atomic_width: Some(128),  | 
 | 20 | +        panic_strategy: PanicStrategy::Abort,  | 
 | 21 | +        abi_blacklist: super::arm_base::abi_blacklist(),  | 
 | 22 | +        .. Default::default()  | 
 | 23 | +    };  | 
 | 24 | +    Ok(Target {  | 
 | 25 | +        llvm_target: "aarch64-unknown-none".to_string(),  | 
 | 26 | +        target_endian: "little".to_string(),  | 
 | 27 | +        target_pointer_width: "64".to_string(),  | 
 | 28 | +        target_c_int_width: "32".to_string(),  | 
 | 29 | +        target_os: "none".to_string(),  | 
 | 30 | +        target_env: String::new(),  | 
 | 31 | +        target_vendor: String::new(),  | 
 | 32 | +        data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),  | 
 | 33 | +        arch: "aarch64".to_string(),  | 
 | 34 | +        linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),  | 
 | 35 | +        options: opts,  | 
 | 36 | +    })  | 
 | 37 | +}  | 
0 commit comments