From 910e650f9b539a4d813dbd59ab2273690f5b646e Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 17 Apr 2026 15:38:33 +0200 Subject: [PATCH 1/2] Update the cc crate for rustc_llvm Latest stacker needs a newer cc than 1.2.16 as older versions don't have windows arm64ec support. --- Cargo.lock | 5 +++-- compiler/rustc_llvm/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) 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 From 017dec40f689927e16dbae1b61cbb04cd9c8b879 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 8 May 2026 16:41:40 +0200 Subject: [PATCH 2/2] Build C code with LTO when LTO is enabled for rust code --- src/bootstrap/src/utils/cc_detect.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 }