Skip to content

Commit e4f46b9

Browse files
committedMay 14, 2019
Don't compile C code on riscv targets
This fixes a longstanding bug in compiler-builtins where C code was compiled for the riscv targets but when distributed in rust-lang/rust all the C code was actually compiled for x86_64 since there is no configured C compiler for riscv. This was exposed by #286 by accident but the underlying cause was somewhat unrelated. For now we forcibly disable C code for riscv targets, and when the C compiler story is sorted out in rust-lang/rust and with `cc-rs` we can reenable. For now just use all the Rust definitions. cc rust-lang/rust#60747
1 parent e3b53f9 commit e4f46b9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎build.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ fn main() {
3737
// build anything and we rely on the upstream implementation of compiler-rt
3838
// functions
3939
if !cfg!(feature = "mangled-names") && cfg!(feature = "c") {
40-
// Don't use C compiler for bitcode-only wasm and nvptx
41-
if !target.contains("wasm32") && !target.contains("nvptx") {
40+
// Don't use a C compiler for these targets:
41+
//
42+
// * wasm32 - clang 8 for wasm is somewhat hard to come by and it's
43+
// unlikely that the C is really that much better than our own Rust.
44+
// * nvptx - everything is bitcode, not compatible with mixed C/Rust
45+
// * riscv - the rust-lang/rust distribution container doesn't have a C
46+
// compiler nor is cc-rs ready for compilation to riscv (at this
47+
// time). This can probably be removed in the future
48+
if !target.contains("wasm32") && !target.contains("nvptx") && !target.starts_with("riscv") {
4249
#[cfg(feature = "c")]
4350
c::compile(&llvm_target);
4451
println!("cargo:rustc-cfg=use_c");

1 commit comments

Comments
 (1)

alistair23 commented on Nov 6, 2023

@alistair23
Contributor

@alexcrichton is there a tracking issue of what's required to be able to revert this commit?

Please sign in to comment.