-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rasmus Thomsen
committed
Oct 9, 2018
1 parent
a6e5d43
commit 7abac07
Showing
2 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
From b9f3dc661b9bbe0f1eee70dd8acb9c0203286c2d Mon Sep 17 00:00:00 2001 | ||
From: Rasmus Thomsen <rasmus.thomsen@protonmail.com> | ||
Date: Tue, 9 Oct 2018 10:20:47 +0200 | ||
Subject: [PATCH] Add armv7l targets | ||
|
||
This spares us from having to hack around armv7l->armv7 for all | ||
packages that need this. | ||
--- | ||
.../spec/armv7l_unknown_linux_gnueabihf.rs | 36 +++++++++++++++++ | ||
.../spec/armv7l_unknown_linux_musleabihf.rs | 40 +++++++++++++++++++ | ||
src/librustc_target/spec/mod.rs | 3 ++ | ||
3 files changed, 79 insertions(+) | ||
create mode 100644 src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs | ||
create mode 100644 src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs | ||
|
||
diff --git a/src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs b/src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs | ||
new file mode 100644 | ||
index 000000000..14e8fa9dc | ||
--- /dev/null | ||
+++ b/src/librustc_target/spec/armv7l_unknown_linux_gnueabihf.rs | ||
@@ -0,0 +1,36 @@ | ||
+// Copyright 2016 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. | ||
+ | ||
+use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; | ||
+ | ||
+pub fn target() -> TargetResult { | ||
+ let base = super::linux_base::opts(); | ||
+ Ok(Target { | ||
+ llvm_target: "armv7-unknown-linux-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: "linux".to_string(), | ||
+ target_env: "gnu".to_string(), | ||
+ target_vendor: "unknown".to_string(), | ||
+ linker_flavor: LinkerFlavor::Gcc, | ||
+ | ||
+ options: TargetOptions { | ||
+ // Info about features at https://wiki.debian.org/ArmHardFloatPort | ||
+ features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), | ||
+ cpu: "generic".to_string(), | ||
+ max_atomic_width: Some(64), | ||
+ abi_blacklist: super::arm_base::abi_blacklist(), | ||
+ .. base | ||
+ } | ||
+ }) | ||
+} | ||
diff --git a/src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs b/src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs | ||
new file mode 100644 | ||
index 000000000..6e71cb307 | ||
--- /dev/null | ||
+++ b/src/librustc_target/spec/armv7l_unknown_linux_musleabihf.rs | ||
@@ -0,0 +1,40 @@ | ||
+// Copyright 2016 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. | ||
+ | ||
+use spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; | ||
+ | ||
+pub fn target() -> TargetResult { | ||
+ let base = super::linux_musl_base::opts(); | ||
+ Ok(Target { | ||
+ // It's important we use "gnueabihf" and not "musleabihf" here. LLVM | ||
+ // uses it to determine the calling convention and float ABI, and LLVM | ||
+ // doesn't support the "musleabihf" value. | ||
+ llvm_target: "armv7-unknown-linux-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: "linux".to_string(), | ||
+ target_env: "musl".to_string(), | ||
+ target_vendor: "unknown".to_string(), | ||
+ linker_flavor: LinkerFlavor::Gcc, | ||
+ | ||
+ // Most of these settings are copied from the armv7_unknown_linux_gnueabihf | ||
+ // target. | ||
+ options: TargetOptions { | ||
+ features: "+v7,+vfp3,+d16,+thumb2,-neon".to_string(), | ||
+ cpu: "generic".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 e54cd7731..615872f52 100644 | ||
--- a/src/librustc_target/spec/mod.rs | ||
+++ b/src/librustc_target/spec/mod.rs | ||
@@ -372,6 +372,9 @@ supported_targets! { | ||
("armv7-unknown-cloudabi-eabihf", armv7_unknown_cloudabi_eabihf), | ||
("i686-unknown-cloudabi", i686_unknown_cloudabi), | ||
("x86_64-unknown-cloudabi", x86_64_unknown_cloudabi), | ||
+ | ||
+ ("armv7l-unknown-linux-gnueabihf", armv7l_unknown_linux_gnueabihf), | ||
+ ("armv7l-unknown-linux-musleabihf", armv7l_unknown_linux_musleabihf), | ||
} | ||
|
||
/// Everything `rustc` knows about how to compile for a specific target. | ||
-- | ||
2.19.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters