Skip to content

Commit eb18f78

Browse files
committed
Add riscv32 CI run
1 parent 642e259 commit eb18f78

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

.github/workflows/main.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
os: ubuntu-latest
5959
- tuple: aarch64_be-unknown-linux-gnu
6060
os: ubuntu-latest
61+
- tuple: riscv32gc-unknown-linux-gnu
62+
os: ubuntu-latest
6163
- tuple: riscv64gc-unknown-linux-gnu
6264
os: ubuntu-latest
6365
- tuple: powerpc-unknown-linux-gnu
@@ -154,6 +156,11 @@ jobs:
154156
tuple: powerpc64le-unknown-linux-gnu
155157
os: ubuntu-latest
156158
test_everything: true
159+
- target:
160+
tuple: riscv32gc-unknown-linux-gnu
161+
os: ubuntu-latest
162+
test_everything: true
163+
build_std: true
157164
- target:
158165
tuple: riscv64gc-unknown-linux-gnu
159166
os: ubuntu-latest
@@ -237,7 +244,7 @@ jobs:
237244
# ... while Linux goes to `run-docker.sh`
238245
- run: ./ci/run-docker.sh ${{ matrix.target.tuple }}
239246
shell: bash
240-
if: "matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb')"
247+
if: matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb')
241248
env:
242249
TARGET: ${{ matrix.target.tuple }}
243250

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ubuntu:25.04
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
gcc libc6-dev qemu-user ca-certificates \
5+
wget xz-utils make file llvm
6+
7+
ENV VERSION=2025.01.20
8+
9+
RUN wget "https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/${VERSION}/riscv32-glibc-ubuntu-24.04-gcc-nightly-${VERSION}-nightly.tar.xz" \
10+
-O riscv-toolchain.tar.xz
11+
RUN tar -xJf riscv-toolchain.tar.xz
12+
13+
ENV CARGO_TARGET_RISCV32GC_UNKNOWN_LINUX_GNU_LINKER=/riscv/bin/riscv32-unknown-linux-gnu-gcc \
14+
CARGO_TARGET_RISCV32GC_UNKNOWN_LINUX_GNU_RUNNER="qemu-riscv32 -cpu max -L /riscv/sysroot" \
15+
OBJDUMP=llvm-objdump

ci/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ case ${TARGET} in
4444
;;
4545
# Some of our test dependencies use the deprecated `gcc` crates which
4646
# doesn't detect RISC-V compilers automatically, so do it manually here.
47-
riscv64*)
47+
riscv*)
4848
export RUSTFLAGS="${RUSTFLAGS} -Ctarget-feature=+zk,+zks,+zbb,+zbc"
4949
export TARGET_CC="riscv64-linux-gnu-gcc"
5050
;;

crates/stdarch-test/src/disassembly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub(crate) fn disassemble_myself() -> HashSet<Function> {
7777
let add_args = if cfg!(target_vendor = "apple") && cfg!(target_arch = "aarch64") {
7878
// Target features need to be enabled for LLVM objdump on Darwin ARM64
7979
vec!["--mattr=+v8.6a,+crypto,+tme"]
80-
} else if cfg!(target_arch = "riscv64") {
80+
} else if cfg!(any(target_arch = "riscv32", target_arch = "riscv64")) {
8181
vec!["--mattr=+zk,+zks,+zbc,+zbb"]
8282
} else {
8383
vec![]

0 commit comments

Comments
 (0)