Skip to content

Commit 728ec85

Browse files
author
Jorge Aparicio
committed
sparc64-linux support
1 parent 8aef058 commit 728ec85

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed

mk/cfg/sparc64-unknown-linux-gnu.mk

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# rustbuild-only target

src/liballoc_jemalloc/build.rs

+6
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,12 @@ fn main() {
151151
cmd.arg(format!("--host={}", build_helper::gnu_target(&target)));
152152
cmd.arg(format!("--build={}", build_helper::gnu_target(&host)));
153153

154+
// for some reason, jemalloc configure doesn't detect this value
155+
// automatically for this target
156+
if target == "sparc64-unknown-linux-gnu" {
157+
cmd.arg("--with-lg-quantum=4");
158+
}
159+
154160
run(&mut cmd);
155161
let mut make = Command::new(build_helper::make(&host));
156162
make.current_dir(&build_dir)

src/librustc_back/target/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ supported_targets! {
157157
("mips-unknown-linux-uclibc", mips_unknown_linux_uclibc),
158158
("mipsel-unknown-linux-uclibc", mipsel_unknown_linux_uclibc),
159159

160+
("sparc64-unknown-linux-gnu", sparc64_unknown_linux_gnu),
161+
160162
("i686-linux-android", i686_linux_android),
161163
("arm-linux-androideabi", arm_linux_androideabi),
162164
("armv7-linux-androideabi", armv7_linux_androideabi),
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, TargetResult};
12+
13+
pub fn target() -> TargetResult {
14+
let mut base = super::linux_base::opts();
15+
base.cpu = "v9".to_string();
16+
base.max_atomic_width = Some(64);
17+
base.exe_allocation_crate = "alloc_system".to_string();
18+
19+
Ok(Target {
20+
llvm_target: "sparc64-unknown-linux-gnu".to_string(),
21+
target_endian: "big".to_string(),
22+
target_pointer_width: "64".to_string(),
23+
data_layout: "E-m:e-i64:64-n32:64-S128".to_string(),
24+
arch: "sparc64".to_string(),
25+
target_os: "linux".to_string(),
26+
target_env: "gnu".to_string(),
27+
target_vendor: "unknown".to_string(),
28+
options: base,
29+
})
30+
}

src/libstd/os/linux/raw.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,9 @@ mod arch {
157157
}
158158
}
159159

160-
#[cfg(target_arch = "mips64")]
161-
mod arch {
162-
pub use libc::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
163-
}
164-
165-
#[cfg(target_arch = "s390x")]
160+
#[cfg(any(target_arch = "mips64",
161+
target_arch = "s390x",
162+
target_arch = "sparc64"))]
166163
mod arch {
167164
pub use libc::{off_t, ino_t, nlink_t, blksize_t, blkcnt_t, stat, time_t};
168165
}

0 commit comments

Comments
 (0)