Skip to content
/ rust Public
forked from rust-lang/rust

Commit 98dd404

Browse files
authored
Rollup merge of rust-lang#158766 - eshattow:linux-musl-riscv64-ci, r=marcoieni
Promote riscv64-unknown-linux-musl to tier 2 with host tools MCP: rust-lang/compiler-team#982 Implements rust-lang#156191
2 parents 83e4343 + 2af4af2 commit 98dd404

14 files changed

Lines changed: 118 additions & 42 deletions

File tree

compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ pub(crate) fn target() -> Target {
1010
metadata: TargetMetadata {
1111
description: Some("RISC-V Linux (kernel 4.20, musl 1.2.5)".into()),
1212
tier: Some(2),
13-
host_tools: Some(false),
13+
host_tools: Some(true),
1414
std: Some(true),
1515
},
1616
pointer_width: 64,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Change this file to make users of the `download-ci-llvm` configuration download
22
a new version of LLVM from CI, even if the LLVM submodule hasn’t changed.
33

4-
Last change is for: https://github.com/rust-lang/rust/pull/157385
4+
Last change is for: https://github.com/rust-lang/rust/pull/158766

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ pub(crate) fn is_ci_llvm_available_for_target(
249249
("powerpc64le-unknown-linux-gnu", false),
250250
("powerpc64le-unknown-linux-musl", false),
251251
("riscv64gc-unknown-linux-gnu", false),
252+
("riscv64gc-unknown-linux-musl", false),
252253
("s390x-unknown-linux-gnu", false),
253254
("x86_64-pc-windows-gnullvm", false),
254255
("x86_64-unknown-freebsd", false),

src/bootstrap/src/core/download.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,7 @@ pub(crate) fn is_download_ci_available(target_triple: &str, llvm_assertions: boo
481481
"powerpc64le-unknown-linux-gnu",
482482
"powerpc64le-unknown-linux-musl",
483483
"riscv64gc-unknown-linux-gnu",
484+
"riscv64gc-unknown-linux-musl",
484485
"s390x-unknown-linux-gnu",
485486
"x86_64-apple-darwin",
486487
"x86_64-pc-windows-gnu",

src/ci/docker/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,22 @@ For targets: `riscv64-unknown-linux-gnu`
462462
- C compiler > gcc version = 8.5.0
463463
- C compiler > C++ = ENABLE -- to cross compile LLVM
464464
465+
### `riscv64-unknown-linux-musl.defconfig`
466+
467+
For targets: `riscv64-unknown-linux-musl`
468+
469+
- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET}
470+
- Path and misc options > Use a mirror = ENABLE
471+
- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc
472+
- Target options > Target Architecture = riscv
473+
- Target options > Bitness = 64-bit
474+
- Operating System > Target OS = linux
475+
- Operating System > Linux kernel version = 4.20.17
476+
- Binary utilities > Version of binutils = 2.40
477+
- C-library > musl version = 1.2.5
478+
- C compiler > gcc version = 8.5.0
479+
- C compiler > C++ = ENABLE -- to cross compile LLVM
480+
465481
### `s390x-linux-gnu.defconfig`
466482
467483
For targets: `s390x-unknown-linux-gnu`

src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile renamed to src/ci/docker/host-x86_64/dist-riscv64-linux-gnu/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ RUN sh /scripts/rustbuild-setup.sh
1212
WORKDIR /tmp
1313

1414
COPY scripts/crosstool-ng-build.sh /scripts/
15-
COPY host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.defconfig /tmp/crosstool.defconfig
15+
COPY host-x86_64/dist-riscv64-linux-gnu/riscv64-unknown-linux-gnu.defconfig /tmp/crosstool.defconfig
1616
RUN /scripts/crosstool-ng-build.sh
1717

1818
COPY scripts/sccache.sh /scripts/

src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.defconfig renamed to src/ci/docker/host-x86_64/dist-riscv64-linux-gnu/riscv64-unknown-linux-gnu.defconfig

File renamed without changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM ubuntu:22.04
2+
3+
COPY scripts/cross-apt-packages.sh /scripts/
4+
RUN sh /scripts/cross-apt-packages.sh
5+
6+
COPY scripts/crosstool-ng.sh /scripts/
7+
COPY scripts/crosstool-ng-sha256-20260705.diff /scripts/
8+
RUN sh /scripts/crosstool-ng.sh
9+
10+
COPY scripts/rustbuild-setup.sh /scripts/
11+
RUN sh /scripts/rustbuild-setup.sh
12+
13+
WORKDIR /tmp
14+
15+
COPY scripts/crosstool-ng-build.sh /scripts/
16+
COPY host-x86_64/dist-riscv64-linux-musl/riscv64-unknown-linux-musl.defconfig /tmp/crosstool.defconfig
17+
RUN /scripts/crosstool-ng-build.sh
18+
19+
COPY scripts/sccache.sh /scripts/
20+
RUN sh /scripts/sccache.sh
21+
22+
ENV PATH=$PATH:/x-tools/riscv64-unknown-linux-musl/bin
23+
24+
ENV CC_riscv64gc_unknown_linux_musl=riscv64-unknown-linux-musl-gcc \
25+
AR_riscv64gc_unknown_linux_musl=riscv64-unknown-linux-musl-ar \
26+
CXX_riscv64gc_unknown_linux_musl=riscv64-unknown-linux-musl-g++
27+
28+
ENV HOSTS=riscv64gc-unknown-linux-musl
29+
ENV TARGETS=riscv64gc-unknown-linux-musl
30+
31+
ENV RUST_CONFIGURE_ARGS="--enable-extended \
32+
--enable-full-tools \
33+
--enable-profiler \
34+
--enable-sanitizers \
35+
--disable-docs \
36+
--set target.riscv64gc-unknown-linux-musl.crt-static=false \
37+
--musl-root-riscv64gc=/x-tools/riscv64-unknown-linux-musl/riscv64-unknown-linux-musl/sysroot/usr"
38+
39+
ENV SCRIPT="python3 ../x.py dist --target $TARGETS --host $HOSTS"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CT_CONFIG_VERSION="4"
2+
CT_PREFIX_DIR="/x-tools/${CT_TARGET}"
3+
CT_USE_MIRROR=y
4+
CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc"
5+
CT_VERIFY_DOWNLOAD_DIGEST_SHA256=y
6+
CT_ARCH_RISCV=y
7+
CT_ARCH_USE_MMU=y
8+
CT_ARCH_64=y
9+
CT_ARCH_ARCH="rv64gc"
10+
CT_KERNEL_LINUX=y
11+
CT_LINUX_V_4_20=y
12+
CT_LIBC_MUSL=y
13+
CT_BINUTILS_V_2_40=y
14+
CT_MUSL_V_1_2_5=y
15+
CT_GCC_V_8=y
16+
CT_CC_LANG_CXX=y

src/ci/docker/host-x86_64/dist-various-2/Dockerfile

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ RUN apt-get update && apt-get build-dep -y clang llvm && apt-get install -y --no
2424
# Needed for apt-key to work:
2525
dirmngr \
2626
gpg-agent \
27-
g++-9-arm-linux-gnueabi \
28-
g++-11-riscv64-linux-gnu
27+
g++-9-arm-linux-gnueabi
2928

3029
ENV \
3130
AR_x86_64_unknown_fuchsia=x86_64-unknown-fuchsia-ar \
@@ -71,10 +70,6 @@ RUN env \
7170
CC=arm-linux-gnueabi-gcc-9 CFLAGS="-march=armv7-a" \
7271
CXX=arm-linux-gnueabi-g++-9 CXXFLAGS="-march=armv7-a" \
7372
bash musl.sh armv7 && \
74-
env \
75-
CC=riscv64-linux-gnu-gcc-11 \
76-
CXX=riscv64-linux-gnu-g++-11 \
77-
bash musl.sh riscv64gc && \
7873
rm -rf /build/*
7974

8075
WORKDIR /tmp
@@ -120,7 +115,6 @@ ENV TARGETS=$TARGETS,x86_64-unknown-none
120115
ENV TARGETS=$TARGETS,aarch64-unknown-uefi
121116
ENV TARGETS=$TARGETS,i686-unknown-uefi
122117
ENV TARGETS=$TARGETS,x86_64-unknown-uefi
123-
ENV TARGETS=$TARGETS,riscv64gc-unknown-linux-musl
124118

125119
ENV TARGETS_SANITIZERS=x86_64-unknown-linux-gnuasan
126120
ENV TARGETS_SANITIZERS=$TARGETS_SANITIZERS,x86_64-unknown-linux-gnumsan
@@ -132,11 +126,7 @@ ENV TARGETS_SANITIZERS=$TARGETS_SANITIZERS,x86_64-unknown-linux-gnutsan
132126
# Luckily one of the folders is /usr/local/include so symlink /usr/include/x86_64-linux-gnu/asm there
133127
RUN ln -s /usr/include/x86_64-linux-gnu/asm /usr/local/include/asm
134128

135-
# musl-gcc can't find libgcc_s.so.1 since it doesn't use the standard search paths.
136-
RUN ln -s /usr/riscv64-linux-gnu/lib/libgcc_s.so.1 /usr/lib/gcc-cross/riscv64-linux-gnu/11/
137-
138129
ENV RUST_CONFIGURE_ARGS="--enable-extended --enable-lld --enable-llvm-bitcode-linker --disable-docs \
139-
--musl-root-armv7=/musl-armv7 \
140-
--musl-root-riscv64gc=/musl-riscv64gc"
130+
--musl-root-armv7=/musl-armv7"
141131

142132
ENV SCRIPT="python3 ../x.py dist --host= --target $TARGETS && python3 ../x.py dist --host= --set build.sanitizers=true --target $TARGETS_SANITIZERS"

0 commit comments

Comments
 (0)