From adddee4946fb2138f8aa4bc56daafed939301535 Mon Sep 17 00:00:00 2001 From: MikaelUrankar Date: Sat, 2 Feb 2019 16:41:38 +0100 Subject: [PATCH] Add FreeBSD armv6 and armv7 targets --- src/bootstrap/bootstrap.py | 4 ++++ .../spec/armv6_unknown_freebsd.rs | 24 +++++++++++++++++++ .../spec/armv7_unknown_freebsd.rs | 24 +++++++++++++++++++ src/librustc_target/spec/mod.rs | 2 ++ 4 files changed, 54 insertions(+) create mode 100644 src/librustc_target/spec/armv6_unknown_freebsd.rs create mode 100644 src/librustc_target/spec/armv7_unknown_freebsd.rs diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 119b38bcc99dc..7813d9bd63c02 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -262,6 +262,10 @@ def default_build_triple(): cputype = 'arm' if ostype == 'linux-android': ostype = 'linux-androideabi' + elif ostype == 'unknown-freebsd': + cputype = subprocess.check_output( + ['uname', '-p']).strip().decode(default_encoding) + ostype = 'unknown-freebsd' elif cputype == 'armv6l': cputype = 'arm' if ostype == 'linux-android': diff --git a/src/librustc_target/spec/armv6_unknown_freebsd.rs b/src/librustc_target/spec/armv6_unknown_freebsd.rs new file mode 100644 index 0000000000000..39886a16a7403 --- /dev/null +++ b/src/librustc_target/spec/armv6_unknown_freebsd.rs @@ -0,0 +1,24 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + let base = super::freebsd_base::opts(); + Ok(Target { + llvm_target: "armv6-unknown-freebsd-gnueabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "freebsd".to_string(), + target_env: "gnueabihf".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + features: "+v6,+vfp2".to_string(), + max_atomic_width: Some(64), + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + } + }) +} diff --git a/src/librustc_target/spec/armv7_unknown_freebsd.rs b/src/librustc_target/spec/armv7_unknown_freebsd.rs new file mode 100644 index 0000000000000..ba63fd2bf053f --- /dev/null +++ b/src/librustc_target/spec/armv7_unknown_freebsd.rs @@ -0,0 +1,24 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; + +pub fn target() -> TargetResult { + let base = super::freebsd_base::opts(); + Ok(Target { + llvm_target: "armv7-unknown-freebsd-gnueabihf".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64".to_string(), + arch: "arm".to_string(), + target_os: "freebsd".to_string(), + target_env: "gnueabihf".to_string(), + target_vendor: "unknown".to_string(), + linker_flavor: LinkerFlavor::Gcc, + + options: TargetOptions { + features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), + max_atomic_width: Some(64), + abi_blacklist: super::arm_base::abi_blacklist(), + .. base + } + }) +} diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index e47da3cff95b6..5c40aaaa6b070 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -366,6 +366,8 @@ supported_targets! { ("aarch64-linux-android", aarch64_linux_android), ("aarch64-unknown-freebsd", aarch64_unknown_freebsd), + ("armv6-unknown-freebsd", armv6_unknown_freebsd), + ("armv7-unknown-freebsd", armv7_unknown_freebsd), ("i686-unknown-freebsd", i686_unknown_freebsd), ("powerpc64-unknown-freebsd", powerpc64_unknown_freebsd), ("x86_64-unknown-freebsd", x86_64_unknown_freebsd),