Skip to content

Commit 04a3850

Browse files
committed
Run tests for riscv64
1 parent 2f74b68 commit 04a3850

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

.github/workflows/main.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ jobs:
5050
- os: ubuntu-latest
5151
env:
5252
TARGET_TRIPLE: aarch64-unknown-linux-gnu
53-
# s390x requires QEMU 6.1 or greater, we could build it from source, but ubuntu 22.04 comes with 6.2 by default
5453
- os: ubuntu-latest
5554
env:
5655
TARGET_TRIPLE: s390x-unknown-linux-gnu
56+
- os: ubuntu-latest
57+
env:
58+
TARGET_TRIPLE: riscv64gc-unknown-linux-gnu
5759
- os: windows-latest
5860
env:
5961
TARGET_TRIPLE: x86_64-pc-windows-msvc
@@ -92,6 +94,12 @@ jobs:
9294
sudo apt-get update
9395
sudo apt-get install -y gcc-s390x-linux-gnu qemu-user
9496
97+
- name: Install riscv64gc toolchain and qemu
98+
if: matrix.env.TARGET_TRIPLE == 'riscv64gc-unknown-linux-gnu'
99+
run: |
100+
sudo apt-get update
101+
sudo apt-get install -y gcc-riscv64-linux-gnu qemu-user
102+
95103
- name: Prepare dependencies
96104
run: ./y.sh prepare
97105

build_system/utils.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ impl Compiler {
4242
"/usr/s390x-linux-gnu".to_owned(),
4343
];
4444
}
45+
"riscv64gc-unknown-linux-gnu" => {
46+
// We are cross-compiling for riscv64. Use the correct linker and run tests in qemu.
47+
self.rustflags.push("-Clinker=riscv64-linux-gnu-gcc".to_owned());
48+
self.rustdocflags.push("-Clinker=riscv64-linux-gnu-gcc".to_owned());
49+
self.runner = vec![
50+
"qemu-riscv64".to_owned(),
51+
"-L".to_owned(),
52+
"/usr/riscv64-linux-gnu".to_owned(),
53+
];
54+
}
4555
"x86_64-pc-windows-gnu" => {
4656
// We are cross-compiling for Windows. Run tests in wine.
4757
self.runner = vec!["wine".to_owned()];

0 commit comments

Comments
 (0)