diff options
Diffstat (limited to 'compiler/rustc_llvm/build.rs')
| -rw-r--r-- | compiler/rustc_llvm/build.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/compiler/rustc_llvm/build.rs b/compiler/rustc_llvm/build.rs index 9a6549379d3..d01f79dcade 100644 --- a/compiler/rustc_llvm/build.rs +++ b/compiler/rustc_llvm/build.rs @@ -106,6 +106,10 @@ fn output(cmd: &mut Command) -> String { } fn main() { + if cfg!(feature = "check_only") { + return; + } + for component in REQUIRED_COMPONENTS.iter().chain(OPTIONAL_COMPONENTS.iter()) { println!("cargo:rustc-check-cfg=cfg(llvm_component,values(\"{component}\"))"); } @@ -167,6 +171,16 @@ fn main() { let cxxflags = output(&mut cmd); let mut cfg = cc::Build::new(); cfg.warnings(false); + + // Prevent critical warnings when we're compiling from rust-lang/rust CI, + // except on MSVC, as the compiler throws warnings that are only reported + // for this platform. See https://github.com/rust-lang/rust/pull/145031#issuecomment-3162677202 + // FIXME(llvm22): It looks like the specific problem code has been removed + // in https://github.com/llvm/llvm-project/commit/e8fc808bf8e78a3c80d1f8e293a92677b92366dd, + // retry msvc once we bump our LLVM version. + if std::env::var_os("CI").is_some() && !target.contains("msvc") { + cfg.warnings_into_errors(true); + } for flag in cxxflags.split_whitespace() { // Ignore flags like `-m64` when we're doing a cross build if is_crossed && flag.starts_with("-m") { @@ -212,7 +226,6 @@ fn main() { rerun_if_changed_anything_in_dir(Path::new("llvm-wrapper")); cfg.file("llvm-wrapper/PassWrapper.cpp") .file("llvm-wrapper/RustWrapper.cpp") - .file("llvm-wrapper/ArchiveWrapper.cpp") .file("llvm-wrapper/CoverageMappingWrapper.cpp") .file("llvm-wrapper/SymbolWrapper.cpp") .file("llvm-wrapper/Linker.cpp") @@ -241,7 +254,7 @@ fn main() { println!("cargo:rustc-link-lib=kstat"); } - if (target.starts_with("arm") && !target.contains("freebsd")) && !target.contains("ohos") + if (target.starts_with("arm") && !target.contains("freebsd") && !target.contains("ohos")) || target.starts_with("mips-") || target.starts_with("mipsel-") || target.starts_with("powerpc-") |
