Skip to content

Commit f3068b6

Browse files
committed
linux-musl: Support riscv32gc-unknown-linux-musl
1 parent a0b1f7d commit f3068b6

5 files changed

+22
-17
lines changed

README.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ See also [setup-cross-toolchain-action](https://github.com/taiki-e/setup-cross-t
3333
[1] See target list below for details<br>
3434
[2] Except for sparc-unknown-linux-gnu and loongarch64-unknown-linux-gnu<br>
3535
[3] Except for loongarch64-unknown-linux-gnu<br>
36-
[4] Except for powerpc-unknown-linux-gnuspe, riscv32gc-unknown-linux-gnu, and x86_64-unknown-linux-gnux32<br>
36+
[4] Except for powerpc-unknown-linux-gnuspe, and x86_64-unknown-linux-gnux32<br>
3737

3838
([Dockerfile](docker/linux-gnu.Dockerfile))
3939

@@ -79,12 +79,14 @@ See also [setup-cross-toolchain-action](https://github.com/taiki-e/setup-cross-t
7979

8080
| libc | GCC | clang | C++ | test | host |
8181
| ---- | --- | ----- | --- | ---- | ---- |
82-
| musl 1.2.3 | 9.4.0 [1] | [2] | ✓ (libstdc++) [1] | ✓ (qemu) [3] | [4] |
82+
| musl 1.2.3 [6] | 9.4.0 [1] | [2] | ✓ (libstdc++) [1] | ✓ (qemu) [3] [4] | [5] |
8383

84-
[1] Except for hexagon-unknown-linux-musl<br>
84+
[1] 13.2.0 for risc64gc-unknown-linux-musl, unavailable for hexagon-unknown-linux-musl<br>
8585
[2] 17.0.0-rc3 for hexagon-unknown-linux-musl, otherwise host<br>
8686
[3] hexagon-unknown-linux-musl requires release mode for building test<br>
87-
[4] See target list below for details<br>
87+
[4] Except for riscv32gc-unknown-linux-musl<br>
88+
[5] See target list below for details<br>
89+
[6] 1.2.5 for riscv32
8890

8991
([Dockerfile](docker/linux-musl.Dockerfile))
9092

@@ -101,12 +103,14 @@ See also [setup-cross-toolchain-action](https://github.com/taiki-e/setup-cross-t
101103
| `hexagon-unknown-linux-musl` (tier3) | x86_64 Linux (glibc 2.27+) |
102104
| `i586-unknown-linux-musl` | x86_64 Linux (any libc) |
103105
| `i686-unknown-linux-musl` | x86_64 Linux (any libc) |
104-
| `mips-unknown-linux-musl` | x86_64 Linux (any libc) |
105-
| `mips64-unknown-linux-muslabi64` | x86_64 Linux (any libc) |
106-
| `mips64el-unknown-linux-muslabi64` | x86_64 Linux (any libc) |
107-
| `mipsel-unknown-linux-musl` | x86_64 Linux (any libc) |
106+
| `mips-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
107+
| `mips64-unknown-linux-muslabi64` (tier3) | x86_64 Linux (any libc) |
108+
| `mips64el-unknown-linux-muslabi64` (tier3) | x86_64 Linux (any libc) |
109+
| `mipsel-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
108110
| `powerpc-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
109111
| `powerpc64le-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
112+
| `riscv32gc-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
113+
| `riscv64gc-unknown-linux-musl` | x86_64 Linux (any libc) |
110114
| `s390x-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
111115
| `thumbv7neon-unknown-linux-musleabihf` (tier3) | x86_64 Linux (any libc) |
112116
| `x86_64-unknown-linux-musl` | x86_64 Linux (any libc) |

docker/linux-musl.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ esac
6262
gcc_version=$("${TOOLCHAIN_DIR}/bin/${RUST_TARGET}-gcc" --version | sed -n '1 s/^.*) //p')
6363
export COMMON_FLAGS="--gcc-toolchain=\"\${toolchain_dir}\""
6464
case "${RUST_TARGET}" in
65-
riscv64*)
65+
riscv*)
6666
COMMON_FLAGS="${COMMON_FLAGS} --ld-path=\"\${toolchain_dir}\"/bin/${RUST_TARGET}-ld -B\"\${toolchain_dir}\"/lib/gcc/${RUST_TARGET}/${gcc_version} -L\"\${toolchain_dir}\"/lib/gcc/${RUST_TARGET}/${gcc_version}" \
6767
CXXFLAGS="-I\"\${toolchain_dir}\"/${RUST_TARGET}/include/c++/${gcc_version} -I\"\${toolchain_dir}\"/${RUST_TARGET}/include/c++/${gcc_version}/${RUST_TARGET}" \
6868
/docker/clang-cross.sh

docker/test/test.sh

+7-6
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,9 @@ esac
268268
# Whether or not to run the compiled binaries.
269269
no_run=1
270270
case "${RUST_TARGET}" in
271-
# TODO(riscv32gc-unknown-linux-gnu): libstd's io-related feature on riscv32 linux is broken: https://github.com/rust-lang/rust/issues/88995
272271
# TODO(x86_64-unknown-linux-gnux32): Invalid ELF image for this architecture
273272
# TODO(armeb-unknown-linux-gnueabi): QEMU bug: https://github.com/taiki-e/setup-cross-toolchain-action/commit/ac9e913254a978d102152e484dc4d4b7a144e1ab
274-
riscv32gc-unknown-linux-gnu | x86_64-unknown-linux-gnux32 | armeb-unknown-linux-gnueabi) ;;
273+
x86_64-unknown-linux-gnux32 | armeb-unknown-linux-gnueabi) ;;
275274
aarch64-pc-windows-gnullvm)
276275
# TODO: aarch64 host
277276
case "${dpkg_arch##*-}" in
@@ -285,8 +284,9 @@ esac
285284
no_run_test=""
286285
case "${RUST_TARGET}" in
287286
# TODO(powerpc-unknown-linux-gnuspe): run-pass, but test-run-fail: process didn't exit successfully: `qemu-ppc /tmp/test-gcc/rust/target/powerpc-unknown-linux-gnuspe/debug/deps/rust_test-14b6784dbe26b668` (signal: 4, SIGILL: illegal instruction)
287+
# TODO(riscv32gc-unknown-linux-musl): unsafe precondition(s) violated: ptr::write_bytes requires that the destination pointer is aligned and non-null
288288
# TODO(wasm32-wasip1-threads): failed to invoke command default
289-
powerpc-unknown-linux-gnuspe | wasm32-wasip1-threads) no_run_test=1 ;;
289+
powerpc-unknown-linux-gnuspe | riscv32gc-unknown-linux-musl | wasm32-wasip1-threads) no_run_test=1 ;;
290290
esac
291291

292292
build_mode=debug
@@ -353,8 +353,9 @@ if [[ -z "${no_std}" ]]; then
353353
if [[ -f /BUILD_STD ]]; then
354354
case "${RUST_TARGET}" in
355355
# TODO(powerpc-unknown-linux-musl)
356+
# TODO(riscv32gc-unknown-linux-musl)
356357
# TODO(powerpc64le,s390x,thumbv7neon,mips): libunwind build issue since around 2022-12-16: https://github.com/taiki-e/rust-cross-toolchain/commit/7913d98f9c73ffb83f46ab83019bdc3358503d8a
357-
powerpc-* | powerpc64le-* | s390x-* | thumbv7neon-* | mips*) ;;
358+
powerpc-* | powerpc64le-* | riscv32* | s390x-* | thumbv7neon-* | mips*) ;;
358359
*)
359360
rm -rf "${target_libdir}"
360361
mkdir -p "${self_contained}"
@@ -462,10 +463,10 @@ EOF
462463
case "${RUST_TARGET}" in
463464
# TODO(hexagon): run-fail (segfault)
464465
# TODO(powerpc-unknown-linux-musl)
465-
# TODO(riscv64gc-unknown-linux-musl)
466+
# TODO(riscv*-unknown-linux-musl)
466467
# TODO(s390x-unknown-linux-musl)
467468
# TODO(powerpc64le,thumbv7neon,mips): libunwind build issue since around 2022-12-16: https://github.com/taiki-e/rust-cross-toolchain/commit/7913d98f9c73ffb83f46ab83019bdc3358503d8a
468-
hexagon-* | powerpc-* | powerpc64le-* | riscv64* | s390x-* | thumbv7neon-* | mips*) ;;
469+
hexagon-* | powerpc-* | powerpc64le-* | riscv* | s390x-* | thumbv7neon-* | mips*) ;;
469470
*)
470471
RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static -C link-self-contained=yes" \
471472
run_cargo build --no-default-features

platform-support-status-tier3.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ See [platform-support-status.md](platform-support-status.md) for Tier 1 & Tier 2
113113
- [x] powerpc64le-unknown-freebsd
114114
- [x] powerpc64le-unknown-linux-musl
115115
- [x] riscv32gc-unknown-linux-gnu
116-
- [ ] riscv32gc-unknown-linux-musl
116+
- [x] riscv32gc-unknown-linux-musl
117117
- [ ] riscv32im-risc0-zkvm-elf
118118
- [ ] riscv32ima-unknown-none-elf
119119
- [ ] riscv32imac-esp-espidf

tools/target-list-shared.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ linux_musl_targets=(
6666
# powerpc-unknown-linux-muslspe # tier3, TODO: https://github.com/rust-lang/rust/blob/842d6fc32e3d0d26bb11fbe6a2f6ae2afccc06cb/src/doc/rustc/src/platform-support/powerpc-unknown-linux-muslspe.md
6767
# powerpc64-unknown-linux-musl # tier3, TODO: ABI version 1 is not compatible with ABI version 2 output
6868
powerpc64le-unknown-linux-musl # tier3
69-
# riscv32gc-unknown-linux-musl # tier3, TODO
69+
riscv32gc-unknown-linux-musl # tier3
7070
riscv64gc-unknown-linux-musl # tier3
7171
s390x-unknown-linux-musl # tier3
7272
thumbv7neon-unknown-linux-musleabihf # tier3

0 commit comments

Comments
 (0)