diff options
| author | Andre Richter <andre.o.richter@gmail.com> | 2018-08-09 22:04:55 +0200 |
|---|---|---|
| committer | Andre Richter <andre.o.richter@gmail.com> | 2018-08-09 22:10:11 +0200 |
| commit | 898950caf1a7bc9b6c41e74bbfac9591724f307c (patch) | |
| tree | d0a308f0c8f1df691343d3611904939c11ff4510 | |
| parent | b73535f1e9c46a698527fab51b1cc9fad3f53412 (diff) | |
| download | rust-898950caf1a7bc9b6c41e74bbfac9591724f307c.tar.gz rust-898950caf1a7bc9b6c41e74bbfac9591724f307c.zip | |
targets: aarch64: Add bare-metal aarch64 target
A generic AArch64 target that can be used for writing bare-metal code for 64-bit ARM architectures.
| -rw-r--r-- | src/librustc_target/spec/aarch64_unknown_none.rs | 46 | ||||
| -rw-r--r-- | src/librustc_target/spec/mod.rs | 2 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/librustc_target/spec/aarch64_unknown_none.rs b/src/librustc_target/spec/aarch64_unknown_none.rs new file mode 100644 index 00000000000..cfba0614adc --- /dev/null +++ b/src/librustc_target/spec/aarch64_unknown_none.rs @@ -0,0 +1,46 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Generic AArch64 target for bare-metal code +// +// Can be used in conjunction with the `target-feature` and +// `target-cpu` compiler flags to opt-in more hardware-specific +// features. +// +// For example, `-C target-cpu=cortex-a53`. + +use super::{LldFlavor, LinkerFlavor, Target, TargetOptions, PanicStrategy}; + +pub fn target() -> Result<Target, String> { + let opts = TargetOptions { + linker: Some("rust-lld".to_owned()), + executables: true, + relocation_model: "static".to_string(), + disable_redzone: true, + linker_is_gnu: true, + max_atomic_width: Some(128), + panic_strategy: PanicStrategy::Abort, + abi_blacklist: super::arm_base::abi_blacklist(), + .. Default::default() + }; + Ok(Target { + llvm_target: "aarch64-unknown-none".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "64".to_string(), + target_c_int_width: "32".to_string(), + target_os: "none".to_string(), + target_env: "".to_string(), + target_vendor: "".to_string(), + data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(), + arch: "aarch64".to_string(), + linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld), + options: opts, + }) +} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index 6faab77d770..8fc1f6ac4a5 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -379,6 +379,8 @@ supported_targets! { ("x86_64-unknown-hermit", x86_64_unknown_hermit), ("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf), + + ("aarch64-unknown-none", aarch64_unknown_none), } /// Everything `rustc` knows about how to compile for a specific target. |
