Skip to content

Add riscv64gc-unknown-linux-gnu image #1684

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

Merged
merged 4 commits into from
May 3, 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
2 changes: 2 additions & 0 deletions ci/azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ jobs:
TARGET: powerpc64le-unknown-linux-gnu
s390x-unknown-linux-gnu:
TARGET: s390x-unknown-linux-gnu
riscv64gc-unknown-linux-gnu:
TARGET: riscv64gc-unknown-linux-gnu
#wasm32-wasi
# TARGET: wasm32-wasi
sparc64-unknown-linux-gnu:
Expand Down
12 changes: 12 additions & 0 deletions ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM ubuntu:20.04

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-riscv64-linux-gnu libc6-dev-riscv64-cross \
qemu-system-riscv64 linux-headers-generic

ENV CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-linux-gnu-gcc \
CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_RUNNER="qemu-riscv64 -L /usr/riscv64-linux-gnu" \
CC_riscv64gc_unknown_linux_gnu=riscv64-linux-gnu-gcc \
CFLAGS_riscv64gc_unknown_linux_gnu="-mabi=lp64d -fPIC" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is only needed because rust is still using llvm9, with llvm10 the riscv64gc-unknown-linux-gnu target should use the proper defaults now.

PATH=$PATH:/rust/bin
3 changes: 2 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,7 @@ fn test_linux(target: &str) {
let aarch64_musl = target.contains("aarch64") && musl;
let gnuabihf = target.contains("gnueabihf");
let x86_64_gnux32 = target.contains("gnux32") && x86_64;
let riscv64 = target.contains("riscv64");

let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None);
Expand Down Expand Up @@ -2657,7 +2658,7 @@ fn test_linux(target: &str) {
(struct_ == "timex" && field.starts_with("__unused")) ||
// FIXME: It now takes mode_t since glibc 2.31 on some targets.
(struct_ == "ipc_perm" && field == "mode"
&& ((x86_64 || i686 || arm) && gnu || x86_64_gnux32)
&& ((x86_64 || i686 || arm || riscv64) && gnu || x86_64_gnux32)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipc_perm now uses mode_t everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping this because it was introduced in the newest version of glibc and I'd like to wait for a while. On riscv, isn't it newer change?

)
});

Expand Down
21 changes: 8 additions & 13 deletions src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ s! {
__size: [::c_ulong; 7],
}

pub struct timespec {
pub tv_sec: ::time_t,
pub tv_nsec: ::c_long,
}

pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
Expand All @@ -41,7 +36,7 @@ s! {
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub __unused: [::c_int; 2usize],
__unused: [::c_int; 2usize],
}

pub struct stat64 {
Expand All @@ -63,7 +58,7 @@ s! {
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub __unused: [::c_int; 2],
__unused: [::c_int; 2],
}

pub struct statfs {
Expand Down Expand Up @@ -161,11 +156,11 @@ s! {
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::c_ushort,
pub __pad1: ::c_ushort,
__pad1: ::c_ushort,
pub __seq: ::c_ushort,
pub __pad2: ::c_ushort,
pub __unused1: ::c_ulong,
pub __unused2: ::c_ulong,
__pad2: ::c_ushort,
__unused1: ::c_ulong,
__unused2: ::c_ulong,
}

pub struct shmid_ds {
Expand All @@ -177,8 +172,8 @@ s! {
pub shm_cpid: ::pid_t,
pub shm_lpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
pub __unused5: ::c_ulong,
pub __unused6: ::c_ulong,
__unused5: ::c_ulong,
__unused6: ::c_ulong,
}

pub struct flock {
Expand Down