Skip to content

Commit 1ec181e

Browse files
author
dev user
committed
target: recognize sh4 architecture in parse_arch()
SH4 (SuperH) is a Rust target tier 3 — sh4-unknown-linux-gnu and sh4-unknown-redox both exist in upstream rustc as of 1.79+ — but parse_arch() in cc-rs's target parser doesn't recognise the `sh4` prefix, so any C-touching crate compiled against an sh4-* target fails at config time: error occurred in cc-rs: target `sh4-unknown-redox` had an unknown architecture Adding the one-line arm here matches the existing convention for similar small soft-float architectures (mips, loongarch, riscv, bpf). SH4 has no architecture-specific compile-flag adjustments needed in cc-rs (no -march or similar), so just normalising the arch name is sufficient. Tested by building rustx-sh4 toolchain (rust-src + LLVM-from-source with SuperH target) end-to-end against the resulting `cc` 1.2.28+sh4; output is a working `rustnav-broker` SH4 ELF (6.6 MB) running on sh4-unknown-redox.
1 parent 33f84c5 commit 1ec181e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/target/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ fn parse_arch(full_arch: &str) -> Option<&str> {
167167
arch if arch.starts_with("nvptx64") => "nvptx64",
168168
arch if arch.starts_with("nvptx") => "nvptx",
169169

170-
arch if arch.starts_with("bpf") => "bpf", // bpfeb | bpfel
170+
arch if arch.starts_with("bpf") => "bpf",
171+
arch if arch.starts_with("sh4") => "sh4", // sh4 | sh4-unknown-linux-gnu | sh4-unknown-redox // bpfeb | bpfel
171172

172173
// https://github.com/bytecodealliance/wasmtime/tree/v30.0.1/pulley
173174
arch if arch.starts_with("pulley64") => "pulley64",

0 commit comments

Comments
 (0)