Skip to content
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

Standard library support for riscv64gc-unknown-linux-gnu #66899

Merged
merged 3 commits into from
Jan 6, 2020
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.47"
version = "1.0.49"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
checksum = "e450b8da92aa6f274e7c6437692f9f2ce6d701fb73bacfcf87897b3f89a4c20e"
dependencies = [
"jobserver",
"num_cpus",
Expand Down
3 changes: 3 additions & 0 deletions src/libpanic_unwind/gcc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ const UNWIND_DATA_REG: (i32, i32) = (24, 25); // I0, I1
#[cfg(target_arch = "hexagon")]
const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1

#[cfg(target_arch = "riscv64")]
const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11

// The following code is based on GCC's C and C++ personality routines. For reference, see:
// https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/libsupc++/eh_personality.cc
// https://github.com/gcc-mirror/gcc/blob/trunk/libgcc/unwind-c.c
Expand Down
6 changes: 6 additions & 0 deletions src/libstd/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ pub mod consts {
/// - mips64
/// - powerpc
/// - powerpc64
/// - riscv64
/// - s390x
/// - sparc64
#[stable(feature = "env", since = "1.0.0")]
Expand Down Expand Up @@ -1035,6 +1036,11 @@ mod arch {
pub const ARCH: &'static str = "hexagon";
}

#[cfg(target_arch = "riscv64")]
mod arch {
pub const ARCH: &'static str = "riscv64";
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
7 changes: 6 additions & 1 deletion src/libstd/os/linux/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,12 @@ mod arch {
}
}

#[cfg(any(target_arch = "mips64", target_arch = "s390x", target_arch = "sparc64"))]
#[cfg(any(
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64"
))]
mod arch {
pub use libc::{blkcnt_t, blksize_t, ino_t, nlink_t, off_t, stat, time_t};
}
Expand Down
6 changes: 4 additions & 2 deletions src/libstd/os/raw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "s390x"
target_arch = "s390x",
target_arch = "riscv64"
)
),
all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
Expand Down Expand Up @@ -60,7 +61,8 @@ pub type c_char = u8;
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "powerpc64",
target_arch = "s390x"
target_arch = "s390x",
target_arch = "riscv64"
)
),
all(target_os = "android", any(target_arch = "aarch64", target_arch = "arm")),
Expand Down
2 changes: 2 additions & 0 deletions src/libstd/sys/unix/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ macro_rules! cfg_has_statx {
// target_arch = "mips64",
// target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
)))] {
$($then_tt)*
} else {
Expand All @@ -86,6 +87,7 @@ macro_rules! cfg_has_statx {
// target_arch = "mips64",
// target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
)))]
{
$($block_inner)*
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/sys_common/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ pub const MIN_ALIGN: usize = 8;
target_arch = "aarch64",
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64"
target_arch = "sparc64",
target_arch = "riscv64"
)))]
pub const MIN_ALIGN: usize = 16;

Expand Down
3 changes: 3 additions & 0 deletions src/libunwind/libunwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ pub const unwinder_private_data_size: usize = 2;
#[cfg(target_arch = "sparc64")]
pub const unwinder_private_data_size: usize = 2;

#[cfg(target_arch = "riscv64")]
pub const unwinder_private_data_size: usize = 2;

#[cfg(target_os = "emscripten")]
pub const unwinder_private_data_size: usize = 20;

Expand Down