1
Fork 0

Add support for RISC-V 64-bit GNU/Linux

This commit is contained in:
msizanoen1 2019-11-23 14:22:05 +07:00
parent 38aa6bdfd7
commit b830b673e7
7 changed files with 26 additions and 4 deletions

View file

@ -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

View file

@ -878,6 +878,7 @@ pub mod consts {
/// - mips64
/// - powerpc
/// - powerpc64
/// - riscv64
/// - s390x
/// - sparc64
#[stable(feature = "env", since = "1.0.0")]
@ -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::*;

View file

@ -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};
}

View file

@ -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")),
@ -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")),

View file

@ -67,6 +67,7 @@ macro_rules! cfg_has_statx {
// target_arch = "mips64",
// target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
)))] {
$($then_tt)*
} else {
@ -86,6 +87,7 @@ macro_rules! cfg_has_statx {
// target_arch = "mips64",
// target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
)))]
{
$($block_inner)*

View file

@ -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;

View file

@ -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;