From d3210c5ab4b436018395baca87f5e5d4a348c00c Mon Sep 17 00:00:00 2001 From: Alistair Francis Date: Wed, 20 Dec 2023 09:30:11 +1000 Subject: [PATCH] build: Allow building C compiler-rt fallbacks for RISC-V Now that https://github.com/rust-lang/rust/pull/117654 has been merged the rust-lang/rust distribution containers contain RISC-V C compilers. This means that we can now enable the "c" feature fallback. Resolves: https://github.com/rust-lang/compiler-builtins/issues/350 Signed-off-by: Alistair Francis --- build.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index 04861167..d4b2a9b4 100644 --- a/build.rs +++ b/build.rs @@ -59,12 +59,7 @@ fn main() { // * wasm - clang for wasm is somewhat hard to come by and it's // unlikely that the C is really that much better than our own Rust. // * nvptx - everything is bitcode, not compatible with mixed C/Rust - // * riscv - the rust-lang/rust distribution container doesn't have a C - // compiler. - if !target.contains("wasm") - && !target.contains("nvptx") - && (!target.starts_with("riscv") || target.contains("xous")) - { + if !target.contains("wasm") && !target.contains("nvptx") { #[cfg(feature = "c")] c::compile(&llvm_target, &target); } @@ -519,7 +514,7 @@ mod c { } } - if target_arch == "mips" { + if target_arch == "mips" || target_arch == "riscv32" || target_arch == "riscv64" { sources.extend(&[("__bswapsi2", "bswapsi2.c")]); }