You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in particular, this makes the `c` feature for compiler-builtins an explicit opt-in, rather than silently detected by whether `llvm-project` is checked out on disk.
exposing this is necessary because the `cc` crate doesn't support cross-compiling to MSVC, and we want people to be able to run `x check --target foo` regardless of whether they have a c toolchain available.
this also uses the new option in CI, where we *do* want to optimize compiler_builtins.
the new option is off by default for the `dev` channel and on otherwise.
// If `compiler-rt` is available ensure that the `c` feature of the
396
394
// `compiler-builtins` crate is enabled and it's configured to learn where
397
395
// `compiler-rt` is located.
398
-
let compiler_builtins_root = builder.src.join("src/llvm-project/compiler-rt");
399
-
let compiler_builtins_c_feature = if compiler_builtins_root.exists(){
396
+
let compiler_builtins_c_feature = if builder.config.optimized_compiler_builtins{
397
+
// NOTE: this interacts strangely with `llvm-has-rust-patches`. In that case, we enforce `submodules = false`, so this is a no-op.
398
+
// But, the user could still decide to manually use an in-tree submodule.
399
+
//
400
+
// Using system llvm is not supported.
401
+
// FIXME: is that restriction really required? I don't *think* we need the LLVM used by
402
+
// compiler-builtins to match the one linked to rustc, but there's a comment in its build
403
+
// script that makes me nervous: https://github.com/rust-lang/compiler-builtins/blob/31ee4544dbe47903ce771270d6e3bea8654e9e50/build.rs#L575-L579
let compiler_builtins_root = builder.src.join("src/llvm-project/compiler-rt");
406
+
if !compiler_builtins_root.exists() || builder.is_system_llvm(target){
407
+
panic!(
408
+
"need LLVM sources available to build `compiler-rt`, but they weren't present; consider enabling `build.submodules = true`, disabling `optimized-compiler-builtins`, or unsetting `llvm-config`"
409
+
);
410
+
}
400
411
// Note that `libprofiler_builtins/build.rs` also computes this so if
401
412
// you're changing something here please also change that.
0 commit comments