Permalink
Browse files

auto merge of #14963 : w3ln4/rust/master, r=alexcrichton

The aim of these changes is not working out a generic bi-endianness architectures support but to allow people develop for little endian MIPS machines (issue #7190).
  • Loading branch information...
2 parents 71fe44d + 34a384a commit 82ec1aef293ddc5c6373bd7f5ec323fafbdf7901 @bors bors committed Jun 24, 2014
View
@@ -374,6 +374,36 @@ CFG_RUN_TARG_arm-unknown-linux-gnueabi=$(call CFG_RUN_arm-unknown-linux-gnueabi,
RUSTC_FLAGS_arm-unknown-linux-gnueabi :=
RUSTC_CROSS_FLAGS_arm-unknown-linux-gnueabi :=
+# mipsel-linux configuration
+CC_mipsel-linux=mipsel-linux-gcc
+CXX_mipsel-linux=mipsel-linux-g++
+CPP_mipsel-linux=mipsel-linux-gcc
+AR_mipsel-linux=mipsel-linux-ar
+CFG_LIB_NAME_mipsel-linux=lib$(1).so
+CFG_STATIC_LIB_NAME_mipsel-linux=lib$(1).a
+CFG_LIB_GLOB_mipsel-linux=lib$(1)-*.so
+CFG_LIB_DSYM_GLOB_mipsel-linux=lib$(1)-*.dylib.dSYM
+CFG_CFLAGS_mipsel-linux := -mips32 -mabi=32 $(CFLAGS)
+CFG_GCCISH_CFLAGS_mipsel-linux := -Wall -g -fPIC -mips32 -mabi=32 $(CFLAGS)
+CFG_GCCISH_CXXFLAGS_mipsel-linux := -fno-rtti $(CXXFLAGS)
+CFG_GCCISH_LINK_FLAGS_mipsel-linux := -shared -fPIC -g -mips32
+CFG_GCCISH_DEF_FLAG_mipsel-linux := -Wl,--export-dynamic,--dynamic-list=
+CFG_GCCISH_PRE_LIB_FLAGS_mipsel-linux := -Wl,-whole-archive
+CFG_GCCISH_POST_LIB_FLAGS_mipsel-linux := -Wl,-no-whole-archive
+CFG_DEF_SUFFIX_mipsel-linux := .linux.def
+CFG_LLC_FLAGS_mipsel-linux :=
+CFG_INSTALL_NAME_mipsel-linux =
+CFG_LIBUV_LINK_FLAGS_mipsel-linux =
+CFG_EXE_SUFFIX_mipsel-linux :=
+CFG_WINDOWSY_mipsel-linux :=
+CFG_UNIXY_mipsel-linux := 1
+CFG_PATH_MUNGE_mipsel-linux := true
+CFG_LDPATH_mipsel-linux :=
+CFG_RUN_mipsel-linux=
+CFG_RUN_TARG_mipsel-linux=
+RUSTC_FLAGS_mipsel-linux := -C target-cpu=mips32 -C target-feature="+mips32,+o32"
+
+
# mips-unknown-linux-gnu configuration
CC_mips-unknown-linux-gnu=mips-linux-gnu-gcc
CXX_mips-unknown-linux-gnu=mips-linux-gnu-g++
@@ -612,7 +642,7 @@ define CFG_MAKE_TOOLCHAIN
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
$$(call CFG_INSTALL_NAME_$(1),$$(4))
- ifeq ($$(findstring $(HOST_$(1)),arm mips),)
+ ifeq ($$(findstring $(HOST_$(1)),arm mips mipsel),)
# We're using llvm-mc as our assembler because it supports
# .cfi pseudo-ops on mac
View
@@ -404,6 +404,7 @@ mod tests {
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "arm")]
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
fn size_of_32() {
assert_eq!(size_of::<uint>(), 4u);
assert_eq!(size_of::<*uint>(), 4u);
@@ -435,6 +436,7 @@ mod tests {
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "arm")]
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
fn align_of_32() {
assert_eq!(align_of::<uint>(), 4u);
assert_eq!(align_of::<*uint>(), 4u);
View
@@ -268,12 +268,15 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
}
#[cfg(target_arch = "mips")]
+#[cfg(target_arch = "mipsel")]
type Registers = [uint, ..32];
#[cfg(target_arch = "mips")]
+#[cfg(target_arch = "mipsel")]
fn new_regs() -> Box<Registers> { box {[0, .. 32]} }
#[cfg(target_arch = "mips")]
+#[cfg(target_arch = "mipsel")]
fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
procedure: raw::Procedure, sp: *mut uint) {
let sp = align_down(sp);
View
@@ -463,6 +463,7 @@ pub mod types {
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "arm")]
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
pub mod arch {
pub mod c95 {
pub type c_char = i8;
@@ -491,6 +492,7 @@ pub mod types {
}
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
pub mod posix88 {
pub type off_t = i32;
pub type dev_t = u64;
@@ -599,6 +601,7 @@ pub mod types {
}
}
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
pub mod posix01 {
use types::os::arch::c95::{c_long, c_ulong, time_t};
use types::os::arch::posix88::{gid_t, ino_t};
@@ -2209,6 +2212,7 @@ pub mod consts {
}
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
pub mod posix88 {
use types::os::arch::c95::c_int;
use types::common::c95::c_void;
@@ -2483,6 +2487,7 @@ pub mod consts {
pub static PTHREAD_STACK_MIN: size_t = 16384;
#[cfg(target_arch = "mips", target_os = "linux")]
+ #[cfg(target_arch = "mipsel", target_os = "linux")]
pub static PTHREAD_STACK_MIN: size_t = 131072;
pub static CLOCK_REALTIME: c_int = 0;
@@ -2536,6 +2541,7 @@ pub mod consts {
pub static SHUT_RDWR: c_int = 2;
}
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
pub mod bsd44 {
use types::os::arch::c95::c_int;
@@ -2604,6 +2610,7 @@ pub mod consts {
pub static MAP_STACK : c_int = 0x020000;
}
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
pub mod extra {
use types::os::arch::c95::c_int;
@@ -2976,6 +2983,7 @@ pub mod consts {
pub static PTHREAD_STACK_MIN: size_t = 4096;
#[cfg(target_arch = "mips")]
+ #[cfg(target_arch = "mipsel")]
#[cfg(target_arch = "x86")]
#[cfg(target_arch = "x86_64")]
pub static PTHREAD_STACK_MIN: size_t = 2048;
View
@@ -23,20 +23,26 @@ use libc;
#[cfg(target_os = "ios")]
#[cfg(target_os = "freebsd")]
pub static FIONBIO: libc::c_ulong = 0x8004667e;
-#[cfg(target_os = "linux", not(target_arch = "mips"))]
+#[cfg(target_os = "linux", target_arch = "x86")]
+#[cfg(target_os = "linux", target_arch = "x86_64")]
+#[cfg(target_os = "linux", target_arch = "arm")]
#[cfg(target_os = "android")]
pub static FIONBIO: libc::c_ulong = 0x5421;
#[cfg(target_os = "linux", target_arch = "mips")]
+#[cfg(target_os = "linux", target_arch = "mipsel")]
pub static FIONBIO: libc::c_ulong = 0x667e;
#[cfg(target_os = "macos")]
#[cfg(target_os = "ios")]
#[cfg(target_os = "freebsd")]
pub static FIOCLEX: libc::c_ulong = 0x20006601;
-#[cfg(target_os = "linux", not(target_arch = "mips"))]
+#[cfg(target_os = "linux", target_arch = "x86")]
+#[cfg(target_os = "linux", target_arch = "x86_64")]
+#[cfg(target_os = "linux", target_arch = "arm")]
#[cfg(target_os = "android")]
pub static FIOCLEX: libc::c_ulong = 0x5451;
#[cfg(target_os = "linux", target_arch = "mips")]
+#[cfg(target_os = "linux", target_arch = "mipsel")]
pub static FIOCLEX: libc::c_ulong = 0x6601;
#[cfg(target_os = "macos")]
@@ -109,7 +115,9 @@ mod select {
}
}
-#[cfg(target_os = "linux", not(target_arch = "mips"))]
+#[cfg(target_os = "linux", target_arch = "x86")]
+#[cfg(target_os = "linux", target_arch = "x86_64")]
+#[cfg(target_os = "linux", target_arch = "arm")]
#[cfg(target_os = "android")]
mod signal {
use libc;
@@ -153,6 +161,7 @@ mod signal {
}
#[cfg(target_os = "linux", target_arch = "mips")]
+#[cfg(target_os = "linux", target_arch = "mipsel")]
mod signal {
use libc;
@@ -0,0 +1,72 @@
+// Copyright 2012 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 back::target_strs;
+use syntax::abi;
+
+pub fn get_target_strs(target_triple: String, target_os: abi::Os) -> target_strs::t {
+ return target_strs::t {
+ module_asm: "".to_string(),
+
+ data_layout: match target_os {
+ abi::OsMacos => {
+ "e-p:32:32:32\
+ -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
+ -f32:32:32-f64:64:64\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
+
+ abi::OsiOS => {
+ "e-p:32:32:32\
+ -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
+ -f32:32:32-f64:64:64\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
+
+ abi::OsWin32 => {
+ "e-p:32:32:32\
+ -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
+ -f32:32:32-f64:64:64\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
+
+ abi::OsLinux => {
+ "e-p:32:32:32\
+ -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
+ -f32:32:32-f64:64:64\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
+
+ abi::OsAndroid => {
+ "e-p:32:32:32\
+ -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
+ -f32:32:32-f64:64:64\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
+
+ abi::OsFreebsd => {
+ "e-p:32:32:32\
+ -i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64\
+ -f32:32:32-f64:64:64\
+ -v64:64:64-v128:64:128\
+ -a0:0:64-n32".to_string()
+ }
+ },
+
+ target_triple: target_triple,
+
+ cc_args: Vec::new(),
+ };
+}
@@ -18,7 +18,7 @@ use driver::session::Session;
use back;
use back::link;
use back::target_strs;
-use back::{arm, x86, x86_64, mips};
+use back::{arm, x86, x86_64, mips, mipsel};
use middle::lint;
use syntax::abi;
@@ -373,7 +373,8 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
abi::X86 => ("little", "x86", "32"),
abi::X86_64 => ("little", "x86_64", "64"),
abi::Arm => ("little", "arm", "32"),
- abi::Mips => ("big", "mips", "32")
+ abi::Mips => ("big", "mips", "32"),
+ abi::Mipsel => ("little", "mipsel", "32")
};
let fam = match sess.targ_cfg.os {
@@ -452,6 +453,7 @@ static architecture_abis : &'static [(&'static str, abi::Architecture)] = &'stat
("xscale", abi::Arm),
("thumb", abi::Arm),
+ ("mipsel", abi::Mipsel),
("mips", abi::Mips)];
pub fn build_target_config(sopts: &Options) -> Config {
@@ -470,14 +472,16 @@ pub fn build_target_config(sopts: &Options) -> Config {
abi::X86 => (ast::TyI32, ast::TyU32),
abi::X86_64 => (ast::TyI64, ast::TyU64),
abi::Arm => (ast::TyI32, ast::TyU32),
- abi::Mips => (ast::TyI32, ast::TyU32)
+ abi::Mips => (ast::TyI32, ast::TyU32),
+ abi::Mipsel => (ast::TyI32, ast::TyU32)
};
let target_triple = sopts.target_triple.clone();
let target_strs = match arch {
abi::X86 => x86::get_target_strs(target_triple, os),
abi::X86_64 => x86_64::get_target_strs(target_triple, os),
abi::Arm => arm::get_target_strs(target_triple, os),
- abi::Mips => mips::get_target_strs(target_triple, os)
+ abi::Mips => mips::get_target_strs(target_triple, os),
+ abi::Mipsel => mipsel::get_target_strs(target_triple, os)
};
Config {
os: os,
View
@@ -99,6 +99,7 @@ pub mod back {
pub mod link;
pub mod lto;
pub mod mips;
+ pub mod mipsel;
pub mod rpath;
pub mod svh;
pub mod target_strs;
@@ -59,7 +59,7 @@ use middle::trans::type_::Type;
use middle::trans::type_of;
use middle::ty;
use middle::ty::Disr;
-use syntax::abi::{X86, X86_64, Arm, Mips};
+use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
use syntax::ast;
use syntax::attr;
use syntax::attr::IntType;
@@ -365,6 +365,7 @@ fn range_to_inttype(cx: &CrateContext, hint: Hint, bounds: &IntBounds) -> IntTyp
// corresponding to `choose_shortest`. However, we don't run on those yet...?
Arm => at_least_32,
Mips => at_least_32,
+ Mipsel => at_least_32,
}
}
attr::ReprAny => {
@@ -135,6 +135,7 @@ pub fn trans_inline_asm<'a>(bcx: &'a Block<'a>, ia: &ast::InlineAsm)
#[cfg(target_arch = "arm")]
#[cfg(target_arch = "mips")]
+#[cfg(target_arch = "mipsel")]
fn get_clobbers() -> String {
"".to_string()
}
@@ -83,7 +83,7 @@ use std::cell::{Cell, RefCell};
use std::rc::Rc;
use std::{i8, i16, i32, i64};
use std::gc::Gc;
-use syntax::abi::{X86, X86_64, Arm, Mips, Rust, RustIntrinsic};
+use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel, Rust, RustIntrinsic};
use syntax::ast_util::{local_def, is_local};
use syntax::attr::AttrMetaMethods;
use syntax::attr;
@@ -1006,7 +1006,7 @@ pub fn call_memcpy(cx: &Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef,
let _icx = push_ctxt("call_memcpy");
let ccx = cx.ccx();
let key = match ccx.sess().targ_cfg.arch {
- X86 | Arm | Mips => "llvm.memcpy.p0i8.p0i8.i32",
+ X86 | Arm | Mips | Mipsel => "llvm.memcpy.p0i8.p0i8.i32",
X86_64 => "llvm.memcpy.p0i8.p0i8.i64"
};
let memcpy = ccx.get_intrinsic(&key);
@@ -1050,7 +1050,7 @@ fn memzero(b: &Builder, llptr: ValueRef, ty: Type) {
let ccx = b.ccx;
let intrinsic_key = match ccx.sess().targ_cfg.arch {
- X86 | Arm | Mips => "llvm.memset.p0i8.i32",
+ X86 | Arm | Mips | Mipsel => "llvm.memset.p0i8.i32",
X86_64 => "llvm.memset.p0i8.i64"
};
@@ -16,7 +16,7 @@ use middle::trans::cabi_x86_64;
use middle::trans::cabi_arm;
use middle::trans::cabi_mips;
use middle::trans::type_::Type;
-use syntax::abi::{X86, X86_64, Arm, Mips};
+use syntax::abi::{X86, X86_64, Arm, Mips, Mipsel};
#[deriving(Clone, PartialEq)]
pub enum ArgKind {
@@ -110,5 +110,6 @@ pub fn compute_abi_info(ccx: &CrateContext,
X86_64 => cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def),
Arm => cabi_arm::compute_abi_info(ccx, atys, rty, ret_def),
Mips => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
+ Mipsel => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
}
}
Oops, something went wrong.

0 comments on commit 82ec1ae

Please sign in to comment.