Skip to content

Commit 82275c2

Browse files
committed
Add riscv32 CI run
1 parent c5154ba commit 82275c2

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

.github/workflows/main.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ jobs:
5656
os: ubuntu-latest
5757
- tuple: aarch64-unknown-linux-gnu
5858
os: ubuntu-latest
59+
- tuple: riscv32gc-unknown-linux-gnu
60+
os: ubuntu-latest
5961
- tuple: riscv64gc-unknown-linux-gnu
6062
os: ubuntu-latest
6163
- tuple: powerpc-unknown-linux-gnu
@@ -148,6 +150,11 @@ jobs:
148150
os: ubuntu-latest
149151
disable_assert_instr: true
150152
test_everything: true
153+
- target:
154+
tuple: riscv32gc-unknown-linux-gnu
155+
os: ubuntu-latest
156+
test_everything: true
157+
build_std: true
151158
- target:
152159
tuple: riscv64gc-unknown-linux-gnu
153160
os: ubuntu-latest
@@ -193,13 +200,18 @@ jobs:
193200

194201
steps:
195202
- uses: actions/checkout@v4
196-
with:
197-
submodules: recursive
203+
198204
- name: Install Rust
199205
run: |
200206
rustup update nightly --no-self-update
201207
rustup default nightly
202208
- run: rustup target add ${{ matrix.target.tuple }}
209+
if: matrix.build_std == ''
210+
- run: |
211+
rustup component add rust-src
212+
echo "CARGO_UNSTABLE_BUILD_STD=std" >> $GITHUB_ENV
213+
if: matrix.build_std != ''
214+
203215
- run: cargo generate-lockfile
204216

205217
# Configure some env vars based on matrix configuration
@@ -228,7 +240,7 @@ jobs:
228240
# ... while Linux goes to `run-docker.sh`
229241
- run: ./ci/run-docker.sh ${{ matrix.target.tuple }}
230242
shell: bash
231-
if: "matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb')"
243+
if: matrix.target.os == 'ubuntu-latest' && !startsWith(matrix.target.tuple, 'thumb')
232244
env:
233245
TARGET: ${{ matrix.target.tuple }}
234246

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-docker.sh

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ run() {
2727
--env NOSTD \
2828
--env NORUN \
2929
--env RUSTFLAGS \
30+
--env CARGO_UNSTABLE_BUILD_STD \
3031
--volume "${HOME}/.cargo":/cargo \
3132
--volume "$(rustc --print sysroot)":/rust:ro \
3233
--volume "$(pwd)":/checkout:ro \

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)