about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2016-08-16 17:07:55 -0500
committerJorge Aparicio <japaricious@gmail.com>2016-08-16 17:12:51 -0500
commit1cf9cafeb14c4e9b16727b10953da95c5c5b0b1d (patch)
tree120bbd1d01dc1ae9f3dab4e45a0dce33f31e9f9a
parent197be89f367d1240d5f9cd9c4efd77812775354e (diff)
downloadrust-1cf9cafeb14c4e9b16727b10953da95c5c5b0b1d.tar.gz
rust-1cf9cafeb14c4e9b16727b10953da95c5c5b0b1d.zip
add mips-uclibc targets
These targets cover OpenWRT 15.05 devices, which use the soft float ABI
and the uclibc library. None of the other built-in mips targets covered
those devices (mips-gnu is hard float and glibc-based, mips-musl is
musl-based).

With this commit one can now build std for these devices using these
commands:

```
$ configure --enable-rustbuild --target=mips-unknown-linux-uclibc
$ make
```

cc #35673
-rw-r--r--mk/cfg/mips-unknown-linux-uclibc.mk1
-rw-r--r--mk/cfg/mipsel-unknown-linux-uclibc.mk1
-rw-r--r--src/librustc_back/target/mips_unknown_linux_uclibc.rs30
-rw-r--r--src/librustc_back/target/mipsel_unknown_linux_uclibc.rs31
-rw-r--r--src/librustc_back/target/mod.rs2
5 files changed, 65 insertions, 0 deletions
diff --git a/mk/cfg/mips-unknown-linux-uclibc.mk b/mk/cfg/mips-unknown-linux-uclibc.mk
new file mode 100644
index 00000000000..34aee77ae21
--- /dev/null
+++ b/mk/cfg/mips-unknown-linux-uclibc.mk
@@ -0,0 +1 @@
+# rustbuild-only target
diff --git a/mk/cfg/mipsel-unknown-linux-uclibc.mk b/mk/cfg/mipsel-unknown-linux-uclibc.mk
new file mode 100644
index 00000000000..34aee77ae21
--- /dev/null
+++ b/mk/cfg/mipsel-unknown-linux-uclibc.mk
@@ -0,0 +1 @@
+# rustbuild-only target
diff --git a/src/librustc_back/target/mips_unknown_linux_uclibc.rs b/src/librustc_back/target/mips_unknown_linux_uclibc.rs
new file mode 100644
index 00000000000..529bd310391
--- /dev/null
+++ b/src/librustc_back/target/mips_unknown_linux_uclibc.rs
@@ -0,0 +1,30 @@
+// 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 target::{Target, TargetOptions, TargetResult};
+
+pub fn target() -> TargetResult {
+    Ok(Target {
+        llvm_target: "mips-unknown-linux-uclibc".to_string(),
+        target_endian: "big".to_string(),
+        target_pointer_width: "32".to_string(),
+        data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
+        arch: "mips".to_string(),
+        target_os: "linux".to_string(),
+        target_env: "uclibc".to_string(),
+        target_vendor: "unknown".to_string(),
+        options: TargetOptions {
+            cpu: "mips32r2".to_string(),
+            features: "+mips32r2,+soft-float".to_string(),
+            max_atomic_width: 32,
+            ..super::linux_base::opts()
+        },
+    })
+}
diff --git a/src/librustc_back/target/mipsel_unknown_linux_uclibc.rs b/src/librustc_back/target/mipsel_unknown_linux_uclibc.rs
new file mode 100644
index 00000000000..1040a0fbe17
--- /dev/null
+++ b/src/librustc_back/target/mipsel_unknown_linux_uclibc.rs
@@ -0,0 +1,31 @@
+// 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 target::{Target, TargetOptions, TargetResult};
+
+pub fn target() -> TargetResult {
+    Ok(Target {
+        llvm_target: "mipsel-unknown-linux-uclibc".to_string(),
+        target_endian: "little".to_string(),
+        target_pointer_width: "32".to_string(),
+        data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
+        arch: "mips".to_string(),
+        target_os: "linux".to_string(),
+        target_env: "uclibc".to_string(),
+        target_vendor: "unknown".to_string(),
+
+        options: TargetOptions {
+            cpu: "mips32".to_string(),
+            features: "+mips32,+soft-float".to_string(),
+            max_atomic_width: 32,
+            ..super::linux_base::opts()
+        },
+    })
+}
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 18686e3f1d6..86cd86d282c 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -143,6 +143,8 @@ supported_targets! {
     ("i686-unknown-linux-musl", i686_unknown_linux_musl),
     ("mips-unknown-linux-musl", mips_unknown_linux_musl),
     ("mipsel-unknown-linux-musl", mipsel_unknown_linux_musl),
+    ("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
+    ("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc),
 
     ("i686-linux-android", i686_linux_android),
     ("arm-linux-androideabi", arm_linux_androideabi),