diff options
| author | Tim JIANG <p90eri@gmail.com> | 2015-08-09 13:15:50 +0800 |
|---|---|---|
| committer | Overmind JIANG <p90eri@gmail.com> | 2015-08-23 15:38:11 +0800 |
| commit | a1b2deb33b3d8f8e77567afbebdb4a3d27ee97ff (patch) | |
| tree | fe7a50dc54fd4d3525d5888fad69433ece2bede9 /src | |
| parent | e617a17369ef403268adcebc5e3e32a0bb5cf04c (diff) | |
| download | rust-a1b2deb33b3d8f8e77567afbebdb4a3d27ee97ff.tar.gz rust-a1b2deb33b3d8f8e77567afbebdb4a3d27ee97ff.zip | |
New cross target: i686-linux-android
- All the libstd tests are now passing in the optimized build against a Zenfone2 and the x86 Android simulator.
Diffstat (limited to 'src')
| -rw-r--r-- | src/liblibc/lib.rs | 26 | ||||
| -rw-r--r-- | src/librustc_back/target/i686_linux_android.rs | 23 | ||||
| -rw-r--r-- | src/librustc_back/target/mod.rs | 1 | ||||
| -rw-r--r-- | src/libstd/os/android/raw.rs | 3 | ||||
| -rw-r--r-- | src/rt/rust_builtin.c | 7 |
5 files changed, 50 insertions, 10 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 6273c1214ec..6f5c3e27347 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -465,18 +465,19 @@ pub mod types { pub type off_t = i32; pub type dev_t = u32; pub type ino_t = u32; + pub type pid_t = i32; pub type uid_t = u32; pub type gid_t = u32; pub type useconds_t = u32; + pub type mode_t = u16; pub type ssize_t = i32; } - #[cfg(any(target_arch = "x86", + #[cfg(any(all(any(target_arch = "arm", target_arch = "x86"), + not(target_os = "android")), target_arch = "le32", - target_arch = "powerpc", - all(any(target_arch = "arm", target_arch = "x86"), - not(target_os = "android"))))] + target_arch = "powerpc"))] pub mod posix01 { use types::os::arch::c95::{c_short, c_long, time_t}; use types::os::arch::posix88::{dev_t, gid_t, ino_t}; @@ -522,12 +523,13 @@ pub mod types { pub __size: [u32; 9] } } + #[cfg(all(any(target_arch = "arm", target_arch = "x86"), - target_os = "android"))] + target_os = "android"))] pub mod posix01 { - use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t}; + use types::os::arch::c95::{c_uchar, c_uint, c_ulong, c_long, time_t}; use types::os::arch::c99::{c_longlong, c_ulonglong}; - use types::os::arch::posix88::{uid_t, gid_t, ino_t}; + use types::os::arch::posix88::{uid_t, gid_t}; pub type nlink_t = u16; pub type blksize_t = u32; @@ -537,7 +539,7 @@ pub mod types { #[derive(Copy, Clone)] pub struct stat { pub st_dev: c_ulonglong, pub __pad0: [c_uchar; 4], - pub __st_ino: ino_t, + pub __st_ino: c_long, pub st_mode: c_uint, pub st_nlink: c_uint, pub st_uid: uid_t, @@ -545,7 +547,7 @@ pub mod types { pub st_rdev: c_ulonglong, pub __pad3: [c_uchar; 4], pub st_size: c_longlong, - pub st_blksize: blksize_t, + pub st_blksize: c_ulong, pub st_blocks: c_ulonglong, pub st_atime: time_t, pub st_atime_nsec: c_ulong, @@ -567,6 +569,7 @@ pub mod types { pub __size: [u32; 9] } } + #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] pub mod posix01 { @@ -993,7 +996,12 @@ pub mod types { pub mod posix88 { pub type off_t = i64; pub type dev_t = u32; + + #[cfg(target_os = "android")] + pub type ino_t = u64; + #[cfg(not(target_os = "android"))] pub type ino_t = u32; + pub type pid_t = i32; pub type uid_t = u32; pub type gid_t = u32; diff --git a/src/librustc_back/target/i686_linux_android.rs b/src/librustc_back/target/i686_linux_android.rs new file mode 100644 index 00000000000..1fb962d3c6c --- /dev/null +++ b/src/librustc_back/target/i686_linux_android.rs @@ -0,0 +1,23 @@ +// 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 { + Target { + llvm_target: "i686-linux-android".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "32".to_string(), + arch: "x86".to_string(), + target_os: "android".to_string(), + target_env: "gnu".to_string(), + options: super::android_base::opts(), + } +} diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs index 542791ae904..847ab937b37 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -373,6 +373,7 @@ impl Target { aarch64_unknown_linux_gnu, x86_64_unknown_linux_musl, + i686_linux_android, arm_linux_androideabi, aarch64_linux_android, diff --git a/src/libstd/os/android/raw.rs b/src/libstd/os/android/raw.rs index e5e89ad800a..cad80c55140 100644 --- a/src/libstd/os/android/raw.rs +++ b/src/libstd/os/android/raw.rs @@ -15,7 +15,7 @@ #[doc(inline)] pub use self::arch::{dev_t, mode_t, blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t}; -#[cfg(target_arch = "arm")] +#[cfg(any(target_arch = "arm", target_arch = "x86"))] mod arch { use os::raw::{c_uint, c_uchar, c_ulonglong, c_longlong, c_ulong}; use os::unix::raw::{uid_t, gid_t}; @@ -150,3 +150,4 @@ mod arch { pub st_ino: ino_t, } } + diff --git a/src/rt/rust_builtin.c b/src/rt/rust_builtin.c index 9a5eaad4243..945057f8612 100644 --- a/src/rt/rust_builtin.c +++ b/src/rt/rust_builtin.c @@ -39,6 +39,13 @@ rust_list_dir_val(struct dirent* entry_ptr) { return entry_ptr->d_name; } +// Android's struct dirent does have d_type from the very beginning +// (android-3). _DIRENT_HAVE_D_TYPE is not defined all the way to android-21 +// though... +#if defined(__ANDROID__) +# define _DIRENT_HAVE_D_TYPE +#endif + int rust_dir_get_mode(struct dirent* entry_ptr) { #if defined(_DIRENT_HAVE_D_TYPE) || defined(__APPLE__) |
