Skip to content

Commit 1cf9caf

Browse files
author
Jorge Aparicio
committed
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
1 parent 197be89 commit 1cf9caf

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

mk/cfg/mips-unknown-linux-uclibc.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# rustbuild-only target

mk/cfg/mipsel-unknown-linux-uclibc.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# rustbuild-only target
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::{Target, TargetOptions, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
Ok(Target {
15+
llvm_target: "mips-unknown-linux-uclibc".to_string(),
16+
target_endian: "big".to_string(),
17+
target_pointer_width: "32".to_string(),
18+
data_layout: "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
19+
arch: "mips".to_string(),
20+
target_os: "linux".to_string(),
21+
target_env: "uclibc".to_string(),
22+
target_vendor: "unknown".to_string(),
23+
options: TargetOptions {
24+
cpu: "mips32r2".to_string(),
25+
features: "+mips32r2,+soft-float".to_string(),
26+
max_atomic_width: 32,
27+
..super::linux_base::opts()
28+
},
29+
})
30+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::{Target, TargetOptions, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
Ok(Target {
15+
llvm_target: "mipsel-unknown-linux-uclibc".to_string(),
16+
target_endian: "little".to_string(),
17+
target_pointer_width: "32".to_string(),
18+
data_layout: "e-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64".to_string(),
19+
arch: "mips".to_string(),
20+
target_os: "linux".to_string(),
21+
target_env: "uclibc".to_string(),
22+
target_vendor: "unknown".to_string(),
23+
24+
options: TargetOptions {
25+
cpu: "mips32".to_string(),
26+
features: "+mips32,+soft-float".to_string(),
27+
max_atomic_width: 32,
28+
..super::linux_base::opts()
29+
},
30+
})
31+
}

src/librustc_back/target/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ supported_targets! {
143143
("i686-unknown-linux-musl", i686_unknown_linux_musl),
144144
("mips-unknown-linux-musl", mips_unknown_linux_musl),
145145
("mipsel-unknown-linux-musl", mipsel_unknown_linux_musl),
146+
("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
147+
("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc),
146148

147149
("i686-linux-android", i686_linux_android),
148150
("arm-linux-androideabi", arm_linux_androideabi),

0 commit comments

Comments
 (0)