Skip to content

Commit 4db452c

Browse files
committed
Remove custom build script in riscv-semihosting
1 parent 4235ddb commit 4db452c

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

riscv-semihosting/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased]
77

8+
### Changed
9+
10+
- Use `cfg(any(target_arch = "riscv32", target_arch = "riscv64"))` instead of `cfg(riscv)`.
11+
12+
### Removed
13+
14+
- Removed custom build script, as `cfg(riscv)` is no longer necessary.
15+
816
## [v0.2.0] - 2025-06-10
917

1018
### Changed

riscv-semihosting/build.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

riscv-semihosting/src/lib.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@
180180
#![deny(missing_docs)]
181181
#![no_std]
182182

183-
#[cfg(all(riscv, not(feature = "no-semihosting")))]
184-
use core::arch::asm;
185-
186183
#[macro_use]
187184
mod macros;
188185

@@ -213,15 +210,18 @@ pub unsafe fn syscall<T>(nr: usize, arg: &T) -> usize {
213210
#[inline(always)]
214211
pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
215212
match () {
216-
#[cfg(all(riscv, not(feature = "no-semihosting")))]
213+
#[cfg(all(
214+
any(target_arch = "riscv32", target_arch = "riscv64"),
215+
not(feature = "no-semihosting")
216+
))]
217217
() => {
218218
let mut nr = _nr;
219219
let arg = _arg;
220220
// The instructions below must always be uncompressed, otherwise
221221
// it will be treated as a regular break, hence the norvc option.
222222
//
223223
// See https://github.com/riscv/riscv-semihosting-spec for more details.
224-
asm!("
224+
core::arch::asm!("
225225
.balign 16
226226
.option push
227227
.option norvc
@@ -236,9 +236,12 @@ pub unsafe fn syscall1(_nr: usize, _arg: usize) -> usize {
236236
);
237237
nr
238238
}
239-
#[cfg(all(riscv, feature = "no-semihosting"))]
239+
#[cfg(all(
240+
any(target_arch = "riscv32", target_arch = "riscv64"),
241+
feature = "no-semihosting"
242+
))]
240243
() => 0,
241-
#[cfg(not(riscv))]
244+
#[cfg(not(any(target_arch = "riscv32", target_arch = "riscv64")))]
242245
() => unimplemented!(),
243246
}
244247
}

0 commit comments

Comments
 (0)