Skip to content

Commit

Permalink
linux-musl: Support riscv32gc-unknown-linux-musl
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Sep 5, 2024
1 parent a0b1f7d commit f3068b6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ See also [setup-cross-toolchain-action](https://github.com/taiki-e/setup-cross-t
[1] See target list below for details<br>
[2] Except for sparc-unknown-linux-gnu and loongarch64-unknown-linux-gnu<br>
[3] Except for loongarch64-unknown-linux-gnu<br>
[4] Except for powerpc-unknown-linux-gnuspe, riscv32gc-unknown-linux-gnu, and x86_64-unknown-linux-gnux32<br>
[4] Except for powerpc-unknown-linux-gnuspe, and x86_64-unknown-linux-gnux32<br>

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

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

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

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

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

Expand All @@ -101,12 +103,14 @@ See also [setup-cross-toolchain-action](https://github.com/taiki-e/setup-cross-t
| `hexagon-unknown-linux-musl` (tier3) | x86_64 Linux (glibc 2.27+) |
| `i586-unknown-linux-musl` | x86_64 Linux (any libc) |
| `i686-unknown-linux-musl` | x86_64 Linux (any libc) |
| `mips-unknown-linux-musl` | x86_64 Linux (any libc) |
| `mips64-unknown-linux-muslabi64` | x86_64 Linux (any libc) |
| `mips64el-unknown-linux-muslabi64` | x86_64 Linux (any libc) |
| `mipsel-unknown-linux-musl` | x86_64 Linux (any libc) |
| `mips-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
| `mips64-unknown-linux-muslabi64` (tier3) | x86_64 Linux (any libc) |
| `mips64el-unknown-linux-muslabi64` (tier3) | x86_64 Linux (any libc) |
| `mipsel-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
| `powerpc-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
| `powerpc64le-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
| `riscv32gc-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
| `riscv64gc-unknown-linux-musl` | x86_64 Linux (any libc) |
| `s390x-unknown-linux-musl` (tier3) | x86_64 Linux (any libc) |
| `thumbv7neon-unknown-linux-musleabihf` (tier3) | x86_64 Linux (any libc) |
| `x86_64-unknown-linux-musl` | x86_64 Linux (any libc) |
Expand Down
2 changes: 1 addition & 1 deletion docker/linux-musl.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ esac
gcc_version=$("${TOOLCHAIN_DIR}/bin/${RUST_TARGET}-gcc" --version | sed -n '1 s/^.*) //p')
export COMMON_FLAGS="--gcc-toolchain=\"\${toolchain_dir}\""
case "${RUST_TARGET}" in
riscv64*)
riscv*)
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}" \
CXXFLAGS="-I\"\${toolchain_dir}\"/${RUST_TARGET}/include/c++/${gcc_version} -I\"\${toolchain_dir}\"/${RUST_TARGET}/include/c++/${gcc_version}/${RUST_TARGET}" \
/docker/clang-cross.sh
Expand Down
13 changes: 7 additions & 6 deletions docker/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,9 @@ esac
# Whether or not to run the compiled binaries.
no_run=1
case "${RUST_TARGET}" in
# TODO(riscv32gc-unknown-linux-gnu): libstd's io-related feature on riscv32 linux is broken: https://github.com/rust-lang/rust/issues/88995
# TODO(x86_64-unknown-linux-gnux32): Invalid ELF image for this architecture
# TODO(armeb-unknown-linux-gnueabi): QEMU bug: https://github.com/taiki-e/setup-cross-toolchain-action/commit/ac9e913254a978d102152e484dc4d4b7a144e1ab
riscv32gc-unknown-linux-gnu | x86_64-unknown-linux-gnux32 | armeb-unknown-linux-gnueabi) ;;
x86_64-unknown-linux-gnux32 | armeb-unknown-linux-gnueabi) ;;
aarch64-pc-windows-gnullvm)
# TODO: aarch64 host
case "${dpkg_arch##*-}" in
Expand All @@ -285,8 +284,9 @@ esac
no_run_test=""
case "${RUST_TARGET}" in
# 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)
# TODO(riscv32gc-unknown-linux-musl): unsafe precondition(s) violated: ptr::write_bytes requires that the destination pointer is aligned and non-null
# TODO(wasm32-wasip1-threads): failed to invoke command default
powerpc-unknown-linux-gnuspe | wasm32-wasip1-threads) no_run_test=1 ;;
powerpc-unknown-linux-gnuspe | riscv32gc-unknown-linux-musl | wasm32-wasip1-threads) no_run_test=1 ;;
esac

build_mode=debug
Expand Down Expand Up @@ -353,8 +353,9 @@ if [[ -z "${no_std}" ]]; then
if [[ -f /BUILD_STD ]]; then
case "${RUST_TARGET}" in
# TODO(powerpc-unknown-linux-musl)
# TODO(riscv32gc-unknown-linux-musl)
# TODO(powerpc64le,s390x,thumbv7neon,mips): libunwind build issue since around 2022-12-16: https://github.com/taiki-e/rust-cross-toolchain/commit/7913d98f9c73ffb83f46ab83019bdc3358503d8a
powerpc-* | powerpc64le-* | s390x-* | thumbv7neon-* | mips*) ;;
powerpc-* | powerpc64le-* | riscv32* | s390x-* | thumbv7neon-* | mips*) ;;
*)
rm -rf "${target_libdir}"
mkdir -p "${self_contained}"
Expand Down Expand Up @@ -462,10 +463,10 @@ EOF
case "${RUST_TARGET}" in
# TODO(hexagon): run-fail (segfault)
# TODO(powerpc-unknown-linux-musl)
# TODO(riscv64gc-unknown-linux-musl)
# TODO(riscv*-unknown-linux-musl)
# TODO(s390x-unknown-linux-musl)
# TODO(powerpc64le,thumbv7neon,mips): libunwind build issue since around 2022-12-16: https://github.com/taiki-e/rust-cross-toolchain/commit/7913d98f9c73ffb83f46ab83019bdc3358503d8a
hexagon-* | powerpc-* | powerpc64le-* | riscv64* | s390x-* | thumbv7neon-* | mips*) ;;
hexagon-* | powerpc-* | powerpc64le-* | riscv* | s390x-* | thumbv7neon-* | mips*) ;;
*)
RUSTFLAGS="${RUSTFLAGS:-} -C target-feature=+crt-static -C link-self-contained=yes" \
run_cargo build --no-default-features
Expand Down
2 changes: 1 addition & 1 deletion platform-support-status-tier3.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ See [platform-support-status.md](platform-support-status.md) for Tier 1 & Tier 2
- [x] powerpc64le-unknown-freebsd
- [x] powerpc64le-unknown-linux-musl
- [x] riscv32gc-unknown-linux-gnu
- [ ] riscv32gc-unknown-linux-musl
- [x] riscv32gc-unknown-linux-musl
- [ ] riscv32im-risc0-zkvm-elf
- [ ] riscv32ima-unknown-none-elf
- [ ] riscv32imac-esp-espidf
Expand Down
2 changes: 1 addition & 1 deletion tools/target-list-shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ linux_musl_targets=(
# 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
# powerpc64-unknown-linux-musl # tier3, TODO: ABI version 1 is not compatible with ABI version 2 output
powerpc64le-unknown-linux-musl # tier3
# riscv32gc-unknown-linux-musl # tier3, TODO
riscv32gc-unknown-linux-musl # tier3
riscv64gc-unknown-linux-musl # tier3
s390x-unknown-linux-musl # tier3
thumbv7neon-unknown-linux-musleabihf # tier3
Expand Down

0 comments on commit f3068b6

Please sign in to comment.