Skip to content

Commit cc934bb

Browse files
committed
Only link when the arch is actually supported by builtins
1 parent 6aa82fe commit cc934bb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

build.rs

+10
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,12 @@ mod c_system {
471471
output
472472
}
473473

474+
// This can be obtained by adding the line:
475+
// message(STATUS "All builtin supported architectures: ${ALL_BUILTIN_SUPPORTED_ARCH}")
476+
// to the bottom of compiler-rt/cmake/builtin-config-ix.cmake, then running
477+
// cmake and looking at the output.
478+
const ALL_SUPPORTED_ARCHES : &'static str = "i386;x86_64;arm;armhf;armv6m;armv7m;armv7em;armv7;armv7s;armv7k;aarch64;hexagon;mips;mipsel;mips64;mips64el;powerpc64;powerpc64le;riscv32;riscv64;wasm32;wasm64";
479+
474480
// This function recreates the logic of getArchNameForCompilerRTLib,
475481
// defined in clang/lib/Driver/ToolChain.cpp.
476482
fn get_arch_name_for_compiler_rtlib() -> String {
@@ -499,6 +505,10 @@ mod c_system {
499505
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
500506
let compiler_rt_arch = get_arch_name_for_compiler_rtlib();
501507

508+
if ALL_SUPPORTED_ARCHES.split(";").find(|x| *x == compiler_rt_arch) == None {
509+
return;
510+
}
511+
502512
if let Ok(clang) = env::var("CLANG") {
503513
let output = success_output(
504514
"failed to find clang's compiler-rt",

0 commit comments

Comments
 (0)