Skip to content

Commit

Permalink
Only link when the arch is actually supported by builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
infinity0 committed Aug 24, 2019
1 parent 6aa82fe commit 1e9f88b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,12 @@ mod c_system {
output
}

// This can be obtained by adding the line:
// message(STATUS "All builtin supported architectures: ${ALL_BUILTIN_SUPPORTED_ARCH}")
// to the bottom of compiler-rt/cmake/builtin-config-ix.cmake, then running
// cmake and looking at the output.
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";

// This function recreates the logic of getArchNameForCompilerRTLib,
// defined in clang/lib/Driver/ToolChain.cpp.
fn get_arch_name_for_compiler_rtlib() -> String {
Expand Down Expand Up @@ -499,6 +505,10 @@ mod c_system {
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
let compiler_rt_arch = get_arch_name_for_compiler_rtlib();

if ALL_SUPPORTED_ARCHES.split(";").find(|x| *x == compiler_rt_arch) == None {
return;
}

if let Ok(clang) = env::var("CLANG") {
let output = success_output(
"failed to find clang's compiler-rt",
Expand Down

0 comments on commit 1e9f88b

Please sign in to comment.