Skip to content

New cross target: i686-linux-android #27957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ valopt python "" "set path to python"
valopt jemalloc-root "" "set directory where libjemalloc_pic.a is located"
valopt build "${DEFAULT_BUILD}" "GNUs ./configure syntax LLVM build triple"
valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path (deprecated)"
valopt i686-linux-android-ndk "" "i686-linux-android NDK standalone path"
valopt arm-linux-androideabi-ndk "" "arm-linux-androideabi NDK standalone path"
valopt aarch64-linux-android-ndk "" "aarch64-linux-android NDK standalone path"
valopt release-channel "dev" "the name of the release channel to build"
Expand Down Expand Up @@ -1693,6 +1694,7 @@ putvar CFG_LIBDIR_RELATIVE
putvar CFG_DISABLE_MANAGE_SUBMODULES
putvar CFG_AARCH64_LINUX_ANDROID_NDK
putvar CFG_ARM_LINUX_ANDROIDEABI_NDK
putvar CFG_I686_LINUX_ANDROID_NDK
putvar CFG_MANDIR

# Avoid spurious warnings from clang by feeding it original source on
Expand Down
25 changes: 25 additions & 0 deletions mk/cfg/i686-linux-android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# i686-linux-android configuration
CC_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc
CXX_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-g++
CPP_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-gcc -E
AR_i686-linux-android=$(CFG_I686_LINUX_ANDROID_NDK)/bin/i686-linux-android-ar
CFG_LIB_NAME_i686-linux-android=lib$(1).so
CFG_STATIC_LIB_NAME_i686-linux-android=lib$(1).a
CFG_LIB_GLOB_i686-linux-android=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_i686-linux-android=lib$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_i686-linux-android := -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
CFG_GCCISH_CFLAGS_i686-linux-android := -Wall -g -fPIC -D__i686__ -DANDROID -D__ANDROID__ $(CFLAGS)
CFG_GCCISH_CXXFLAGS_i686-linux-android := -fno-rtti $(CXXFLAGS)
CFG_GCCISH_LINK_FLAGS_i686-linux-android := -shared -fPIC -ldl -g -lm -lsupc++
CFG_GCCISH_DEF_FLAG_i686-linux-android := -Wl,--export-dynamic,--dynamic-list=
CFG_LLC_FLAGS_i686-linux-android :=
CFG_INSTALL_NAME_i686-linux-android =
CFG_EXE_SUFFIX_i686-linux-android :=
CFG_WINDOWSY_i686-linux-android :=
CFG_UNIXY_i686-linux-android := 1
CFG_LDPATH_i686-linux-android :=
CFG_RUN_i686-linux-android=
CFG_RUN_TARG_i686-linux-android=
RUSTC_FLAGS_i686-linux-android :=
RUSTC_CROSS_FLAGS_i686-linux-android :=
CFG_GNU_TRIPLE_i686-linux-android := i686-linux-android
21 changes: 12 additions & 9 deletions src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand All @@ -537,15 +539,15 @@ 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,
pub st_gid: gid_t,
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,
Expand All @@ -567,6 +569,7 @@ pub mod types {
pub __size: [u32; 9]
}
}

#[cfg(any(target_arch = "mips",
target_arch = "mipsel"))]
pub mod posix01 {
Expand Down
26 changes: 26 additions & 0 deletions src/librustc_back/target/i686_linux_android.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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.cpu = "pentium4".to_string();

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: base,
}
}
1 change: 1 addition & 0 deletions src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ impl Target {
aarch64_unknown_linux_gnu,
x86_64_unknown_linux_musl,

i686_linux_android,
arm_linux_androideabi,
aarch64_linux_android,

Expand Down
3 changes: 2 additions & 1 deletion src/libstd/os/android/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -150,3 +150,4 @@ mod arch {
pub st_ino: ino_t,
}
}

7 changes: 7 additions & 0 deletions src/rt/rust_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down