about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-05-08 09:13:19 -0700
committerbors <bors@rust-lang.org>2016-05-08 09:13:19 -0700
commitebe6da34ffc72a701f4189ef7be5ab2c1cb6e8c9 (patch)
tree0cdeaf3f9180cf5db5dde4489d2b7139f331d21f /src
parentcae42a471c13eec8a6470d0845f46f1606d50742 (diff)
parentca03b81abb62b12853d9e0133765355dc6958c59 (diff)
Auto merge of #33414 - Nercury:master, r=alexcrichton
Add armv7-linux-androideabi target

This PR adds `armv7-linux-androideabi` target that matches `armeabi-v7a` Android ABI, ~~downscales `arm-linux-androideabi` target to match `armeabi` Android ABI~~ (TBD later if needed).

This should allow us to get the best performance from every [Android ABI level](http://developer.android.com/ndk/guides/abis.html).

Currently existing target `arm-linux-androideabi` started gaining features out of the supported range of [android `armeabi`](http://developer.android.com/ndk/guides/abis.html). While android compiler does not use a different target for later supported `armv7` architecture, it has distinct ABI name `armeabi-v7a`. We decided to add rust target `armv7-linux-androideabi` to match it.

Note that `NEON`, `VFPv3-D32`, and `ThumbEE` instruction sets are not added, because not all android devices are guaranteed to support all or some of these, and [their availability should be checked at runtime](http://developer.android.com/ndk/guides/abis.html#v7a).

~~This reduces performance of existing `arm-linux-androideabi` and may make it _much_ slower (we are talking more than order of magnitude in some random ad-hoc fp benchmark that I did).~~

Part of #33278.
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/build/config.rs6
-rw-r--r--src/doc/book/getting-started.md1
-rw-r--r--src/librustc_back/target/armv7_linux_androideabi.rs28
-rw-r--r--src/librustc_back/target/mod.rs1
-rw-r--r--src/tools/compiletest/src/runtest.rs8
5 files changed, 40 insertions, 4 deletions
diff --git a/src/bootstrap/build/config.rs b/src/bootstrap/build/config.rs
index 98fdaae64a5..5c4feebedb4 100644
--- a/src/bootstrap/build/config.rs
+++ b/src/bootstrap/build/config.rs
@@ -338,6 +338,12 @@ impl Config {
                                      .or_insert(Target::default());
                     target.ndk = Some(PathBuf::from(value));
                 }
+                "CFG_ARMV7_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
+                    let target = "armv7-linux-androideabi".to_string();
+                    let target = self.target_config.entry(target)
+                                     .or_insert(Target::default());
+                    target.ndk = Some(PathBuf::from(value));
+                }
                 "CFG_I686_LINUX_ANDROID_NDK" if value.len() > 0 => {
                     let target = "i686-linux-androideabi".to_string();
                     let target = self.target_config.entry(target)
diff --git a/src/doc/book/getting-started.md b/src/doc/book/getting-started.md
index e61a76a2c37..e7d05a8d93a 100644
--- a/src/doc/book/getting-started.md
+++ b/src/doc/book/getting-started.md
@@ -98,6 +98,7 @@ unofficial locations.
 |  Target                       | std |rustc|cargo| notes                      |
 |-------------------------------|-----|-----|-----|----------------------------|
 | `aarch64-linux-android`       |  ✓  |     |     | ARM64 Android              |
+| `armv7-linux-androideabi`     |  ✓  |     |     | ARM-v7a Android            |
 | `i686-linux-android`          |  ✓  |     |     | 32-bit x86 Android         |
 | `i686-pc-windows-msvc` (XP)   |  ✓  |     |     | Windows XP support         |
 | `i686-unknown-freebsd`        |  ✓  |  ✓  |  ✓  | 32-bit FreeBSD             |
diff --git a/src/librustc_back/target/armv7_linux_androideabi.rs b/src/librustc_back/target/armv7_linux_androideabi.rs
new file mode 100644
index 00000000000..7096cd9c36d
--- /dev/null
+++ b/src/librustc_back/target/armv7_linux_androideabi.rs
@@ -0,0 +1,28 @@
+// Copyright 2014 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 target::Target;
+
+pub fn target() -> Target {
+    let mut base = super::android_base::opts();
+    base.features = "+v7,+thumb2,+vfp3,+d16".to_string();
+
+    Target {
+        llvm_target: "armv7-none-linux-android".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_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: "android".to_string(),
+        target_env: "gnu".to_string(),
+        target_vendor: "unknown".to_string(),
+        options: base,
+    }
+}
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index c2b86ce28f6..30d0b47029d 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -108,6 +108,7 @@ supported_targets! {
 
     ("i686-linux-android", i686_linux_android),
     ("arm-linux-androideabi", arm_linux_androideabi),
+    ("armv7-linux-androideabi", armv7_linux_androideabi),
     ("aarch64-linux-android", aarch64_linux_android),
 
     ("i686-unknown-freebsd", i686_unknown_freebsd),
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 74e4b81f555..aa1b9d2bafb 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -33,7 +33,7 @@ use std::process::{Command, Output, ExitStatus};
 pub fn run(config: Config, testpaths: &TestPaths) {
     match &*config.target {
 
-        "arm-linux-androideabi" | "aarch64-linux-android" => {
+        "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
             if !config.adb_device_status {
                 panic!("android device not available");
             }
@@ -424,7 +424,7 @@ actual:\n\
 
         let debugger_run_result;
         match &*self.config.target {
-            "arm-linux-androideabi" | "aarch64-linux-android" => {
+            "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
 
                 cmds = cmds.replace("run", "continue");
 
@@ -1132,7 +1132,7 @@ actual:\n\
 
         match &*self.config.target {
 
-            "arm-linux-androideabi" | "aarch64-linux-android" => {
+            "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
                 self._arm_exec_compiled_test(env)
             }
 
@@ -1230,7 +1230,7 @@ actual:\n\
             }
 
             match &*self.config.target {
-                "arm-linux-androideabi"  | "aarch64-linux-android" => {
+                "arm-linux-androideabi" | "armv7-linux-androideabi" | "aarch64-linux-android" => {
                     self._arm_push_aux_shared_library();
                 }
                 _ => {}