Skip to content

Commit 940006d

Browse files
committed
Only link when the arch is actually supported by builtins
1 parent ec70931 commit 940006d

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
@@ -474,6 +474,12 @@ mod c_system {
474474
output
475475
}
476476

477+
// This can be obtained by adding the line:
478+
// message(STATUS "All builtin supported architectures: ${ALL_BUILTIN_SUPPORTED_ARCH}")
479+
// to the bottom of compiler-rt/cmake/builtin-config-ix.cmake, then running
480+
// cmake and looking at the output.
481+
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";
482+
477483
// This function recreates the logic of getArchNameForCompilerRTLib,
478484
// defined in clang/lib/Driver/ToolChain.cpp.
479485
fn get_arch_name_for_compiler_rtlib() -> String {
@@ -502,6 +508,10 @@ mod c_system {
502508
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
503509
let compiler_rt_arch = get_arch_name_for_compiler_rtlib();
504510

511+
if ALL_SUPPORTED_ARCHES.split(";").find(|x| *x == compiler_rt_arch) == None {
512+
return;
513+
}
514+
505515
if let Ok(clang) = env::var("CLANG") {
506516
let output = success_output(
507517
"failed to find clang's compiler-rt",

0 commit comments

Comments
 (0)