about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-02 03:01:48 -0700
committerGitHub <noreply@github.com>2016-09-02 03:01:48 -0700
commit689c6c48ecd3d89d120c6aecf8b69222920e4520 (patch)
tree8bd8088e0fd7273a62b3123ebb9ea5ef1a72405d /src/libstd
parent022cb6d11d7d3529fc09283d058e66017dadeb8c (diff)
parentbbf2c3c31f3dd7703f4a13724bada979a921a65f (diff)
downloadrust-689c6c48ecd3d89d120c6aecf8b69222920e4520.tar.gz
rust-689c6c48ecd3d89d120c6aecf8b69222920e4520.zip
Auto merge of #36024 - japaric:mips64, r=alexcrichton
add mips64-gnu and mips64el-gnu targets

With this commit one can build no_core (and probably no_std as well)
Rust programs for these targets. It's not yet possible to cross compile
std for these targets because rust-lang/libc doesn't know about the
mips64 architecture.

These targets have been tested by cross compiling the "smallest hello"
program (see code below) and then running it under QEMU.

``` rust

extern {
    fn puts(_: *const u8);
}

fn start(_: isize, _: *const *const u8) -> isize {
    unsafe {
        let msg = b"Hello, world!\0";
        puts(msg as *const _ as *const u8);
    }
    0
}

trait Copy {}

trait Sized {}
```

cc #36015
r? @alexcrichton
cc @brson

The cabi stuff is likely wrong. I just copied cabi_mips source and changed some `4`s to `8`s and `32`s to `64`s. It was enough to get libc's `puts` to work but I'd like someone familiar with this module to check it.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/env.rs6
-rw-r--r--src/libstd/os/linux/raw.rs5
2 files changed, 11 insertions, 0 deletions
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index 7a94c396218..9fcc3a80b98 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -659,6 +659,7 @@ pub mod consts {
     /// - arm
     /// - aarch64
     /// - mips
+    /// - mips64
     /// - powerpc
     /// - powerpc64
     #[stable(feature = "env", since = "1.0.0")]
@@ -926,6 +927,11 @@ mod arch {
     pub const ARCH: &'static str = "mips";
 }
 
+#[cfg(target_arch = "mips64")]
+mod arch {
+    pub const ARCH: &'static str = "mips64";
+}
+
 #[cfg(target_arch = "powerpc")]
 mod arch {
     pub const ARCH: &'static str = "powerpc";
diff --git a/src/libstd/os/linux/raw.rs b/src/libstd/os/linux/raw.rs
index 1be76961fea..0f62877500b 100644
--- a/src/libstd/os/linux/raw.rs
+++ b/src/libstd/os/linux/raw.rs
@@ -155,6 +155,11 @@ mod arch {
     }
 }
 
+#[cfg(target_arch = "mips64")]
+mod arch {
+    pub use libc::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
+}
+
 #[cfg(target_arch = "aarch64")]
 mod arch {
     use os::raw::{c_long, c_int};