diff --git a/Cargo.lock b/Cargo.lock index 873182dde9102..f2b11e384f3c9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -560,10 +560,11 @@ version = "0.1.0" [[package]] name = "cc" -version = "1.2.16" +version = "1.2.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +checksum = "e1354349954c6fc9cb0deab020f27f783cf0b604e8bb754dc4658ecf0d29c35f" dependencies = [ + "find-msvc-tools", "jobserver", "libc", "shlex", diff --git a/compiler/rustc_llvm/Cargo.toml b/compiler/rustc_llvm/Cargo.toml index c9f8cd9495834..025299f4ae4eb 100644 --- a/compiler/rustc_llvm/Cargo.toml +++ b/compiler/rustc_llvm/Cargo.toml @@ -11,7 +11,7 @@ libc = "0.2.73" [build-dependencies] # tidy-alphabetical-start # `cc` updates often break things, so we pin it here. -cc = "=1.2.16" +cc = "=1.2.39" shlex = "1.3.0" # tidy-alphabetical-end diff --git a/src/bootstrap/src/utils/cc_detect.rs b/src/bootstrap/src/utils/cc_detect.rs index 1ab2b92070c93..ca25e5dfc5762 100644 --- a/src/bootstrap/src/utils/cc_detect.rs +++ b/src/bootstrap/src/utils/cc_detect.rs @@ -25,7 +25,7 @@ use std::collections::HashSet; use std::iter; use std::path::{Path, PathBuf}; -use crate::core::config::{CompressDebuginfo, TargetSelection}; +use crate::core::config::{CompressDebuginfo, RustcLto, TargetSelection}; use crate::utils::exec::{BootstrapCommand, command}; use crate::{Build, CLang, GitRepo}; @@ -61,6 +61,15 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build { } } } + match build.config.rust_lto { + RustcLto::Off | RustcLto::ThinLocal => {} + RustcLto::Thin => { + cfg.flag_if_supported("-flto=thin"); + } + RustcLto::Fat => { + cfg.flag_if_supported("-flto=full"); + } + } cfg }