From e84116ad53c6e5c1330b00f9f51d40e2aac62acc Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Fri, 24 Apr 2020 18:03:36 +0100 Subject: [PATCH 1/2] Add riscv64gc-unknown-linux-gnu support --- rustup-init.sh | 7 ++++++- src/dist/dist.rs | 1 + tests/mock/clitools.rs | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/rustup-init.sh b/rustup-init.sh index 448cd9d44d..fde1d862ba 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -295,7 +295,9 @@ get_architecture() { s390x) _cputype=s390x ;; - + riscv64) + _cputype=riscv64gc + ;; *) err "unknown CPU type: $_cputype" @@ -321,6 +323,9 @@ get_architecture() { _ostype="${_ostype}eabihf" fi ;; + riscv64gc) + err "riscv64 with 32-bit userland unsupported" + ;; esac fi diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 90551483cd..5b9a9d99af 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -90,6 +90,7 @@ static LIST_ARCHS: &[&str] = &[ "powerpc", "powerpc64", "powerpc64le", + "riscv64gc", "s390x", ]; static LIST_OSES: &[&str] = &[ diff --git a/tests/mock/clitools.rs b/tests/mock/clitools.rs index 9a08c024cf..25b05da644 100644 --- a/tests/mock/clitools.rs +++ b/tests/mock/clitools.rs @@ -980,6 +980,8 @@ pub fn this_host_triple() -> String { "i686" } else if cfg!(target_arch = "x86_64") { "x86_64" + } else if cfg!(target_arch = "riscv64") { + "riscv64gc" } else { unimplemented!() }; From 401800b81d56be2e6bd6f6ee08f3dbc5f73375e7 Mon Sep 17 00:00:00 2001 From: Tom Eccles Date: Tue, 28 Apr 2020 12:31:18 +0100 Subject: [PATCH 2/2] CI support for riscv64gc-unknown-linux-gnu skip-stable because we're not going to release this for now --- ci/actions-templates/README.md | 1 + ci/actions-templates/linux-builds-template.yaml | 1 + ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile | 11 +++++++++++ ci/fetch-rust-docker.bash | 1 + 4 files changed, 14 insertions(+) create mode 100644 ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile diff --git a/ci/actions-templates/README.md b/ci/actions-templates/README.md index 0bb66d0c5f..f70509e04a 100644 --- a/ci/actions-templates/README.md +++ b/ci/actions-templates/README.md @@ -56,6 +56,7 @@ system. | armv7-linux-androideabi | Yes | Two | No | No | | i686-linux-android | Yes | Two | No | No | | x86_64-linux-android | Yes | Two | No | No | +| riscv64gc-unknown-linux-gnu | Yes | --- | No | No | | ----------------------------- | ---------- | ----- | ------ | ---------- | | x86_64-apple-darwin | No | One | Yes | Yes | | ----------------------------- | ---------- | ----- | ------ | ---------- | diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index b7077643b9..a6c725b6ff 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -46,6 +46,7 @@ jobs: - armv7-linux-androideabi # skip-pr skip-master - i686-linux-android # skip-pr skip-master - x86_64-linux-android # skip-pr skip-master + - riscv64gc-unknown-linux-gnu # skip-pr skip-master skip-stable include: - target: x86_64-unknown-linux-gnu run_tests: YES diff --git a/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile b/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000000..1ce61b02eb --- /dev/null +++ b/ci/docker/riscv64gc-unknown-linux-gnu/Dockerfile @@ -0,0 +1,11 @@ +FROM rust-riscv64gc-unknown-linux-gnu + + +# We install a stable toolchain using rustup anyway, this should stop us getting +# confused and still having this toolchain in $PATH +RUN /usr/local/lib/rustlib/uninstall.sh +# Weirdly that doesn't remove these: +RUN rm /usr/local/bin/cargo /usr/local/bin/rust* + +ENV CC_riscv64gc_unknown_linux_gnu=riscv64-unknown-linux-gnu-gcc \ + CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER=riscv64-unknown-linux-gnu-gcc diff --git a/ci/fetch-rust-docker.bash b/ci/fetch-rust-docker.bash index 04aeead578..24f2d6c99e 100644 --- a/ci/fetch-rust-docker.bash +++ b/ci/fetch-rust-docker.bash @@ -32,6 +32,7 @@ case "$TARGET" in x86_64-unknown-freebsd) image=dist-x86_64-freebsd ;; x86_64-unknown-linux-gnu) image=dist-x86_64-linux ;; x86_64-unknown-netbsd) image=dist-x86_64-netbsd ;; + riscv64gc-unknown-linux-gnu) image=dist-various-1 ;; *) exit ;; esac