Skip to content

Commit eb2d6cd

Browse files
committed
Auto merge of #155438 - bjorn3:update_cc, r=<try>
Update the cc crate for rustc_llvm
2 parents f2b291d + 7c0bd03 commit eb2d6cd

7 files changed

Lines changed: 22 additions & 13 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,10 @@ version = "0.1.0"
545545

546546
[[package]]
547547
name = "cc"
548-
version = "1.2.16"
549-
source = "registry+https://github.com/rust-lang/crates.io-index"
550-
checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"
548+
version = "1.2.50"
549+
checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c"
551550
dependencies = [
551+
"find-msvc-tools",
552552
"jobserver",
553553
"libc",
554554
"shlex",

compiler/rustc_llvm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ libc = "0.2.73"
1111
[build-dependencies]
1212
# tidy-alphabetical-start
1313
# `cc` updates often break things, so we pin it here.
14-
cc = "=1.2.16"
14+
cc = "=1.2.50"
1515
shlex = "1.3.0"
1616
# tidy-alphabetical-end
1717

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ pub fn compiler_file(
19171917
return PathBuf::new();
19181918
}
19191919
let mut cmd = command(compiler);
1920-
cmd.args(builder.cc_handled_clags(target, c));
1920+
cmd.args(builder.cc_handled_cflags(target, c));
19211921
cmd.args(builder.cc_unhandled_cflags(target, GitRepo::Rustc, c));
19221922
cmd.arg(format!("-print-file-name={file}"));
19231923
let out = cmd.run_capture_stdout(builder).stdout();

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ fn configure_cmake(
800800
// Needs `suppressed_compiler_flag_prefixes` to be gone, and hence
801801
// https://github.com/llvm/llvm-project/issues/88780 to be fixed.
802802
for flag in builder
803-
.cc_handled_clags(target, CLang::C)
803+
.cc_handled_cflags(target, CLang::C)
804804
.into_iter()
805805
.chain(builder.cc_unhandled_cflags(target, GitRepo::Llvm, CLang::C))
806806
.filter(|flag| !suppressed_compiler_flag_prefixes.iter().any(|p| flag.starts_with(p)))
@@ -821,7 +821,7 @@ fn configure_cmake(
821821
cfg.define("CMAKE_C_FLAGS", cflags);
822822
let mut cxxflags = ccflags.cxxflags.clone();
823823
for flag in builder
824-
.cc_handled_clags(target, CLang::Cxx)
824+
.cc_handled_cflags(target, CLang::Cxx)
825825
.into_iter()
826826
.chain(builder.cc_unhandled_cflags(target, GitRepo::Llvm, CLang::Cxx))
827827
.filter(|flag| {

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2428,9 +2428,9 @@ Please disable assertions with `rust.debug-assertions = false`.
24282428
// Only pass correct values for these flags for the `run-make` suite as it
24292429
// requires that a C++ compiler was configured which isn't always the case.
24302430
if !builder.config.dry_run() && mode == CompiletestMode::RunMake {
2431-
let mut cflags = builder.cc_handled_clags(target, CLang::C);
2431+
let mut cflags = builder.cc_handled_cflags(target, CLang::C);
24322432
cflags.extend(builder.cc_unhandled_cflags(target, GitRepo::Rustc, CLang::C));
2433-
let mut cxxflags = builder.cc_handled_clags(target, CLang::Cxx);
2433+
let mut cxxflags = builder.cc_handled_cflags(target, CLang::Cxx);
24342434
cxxflags.extend(builder.cc_unhandled_cflags(target, GitRepo::Rustc, CLang::Cxx));
24352435
cmd.arg("--cc")
24362436
.arg(builder.cc(target))

src/bootstrap/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ impl Build {
12801280

12811281
/// Returns C flags that `cc-rs` thinks should be enabled for the
12821282
/// specified target by default.
1283-
fn cc_handled_clags(&self, target: TargetSelection, c: CLang) -> Vec<String> {
1283+
fn cc_handled_cflags(&self, target: TargetSelection, c: CLang) -> Vec<String> {
12841284
if self.config.dry_run() {
12851285
return Vec::new();
12861286
}

src/bootstrap/src/utils/cc_detect.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use std::collections::HashSet;
2525
use std::iter;
2626
use std::path::{Path, PathBuf};
2727

28-
use crate::core::config::TargetSelection;
28+
use crate::core::config::{RustcLto, TargetSelection};
2929
use crate::utils::exec::{BootstrapCommand, command};
3030
use crate::{Build, CLang, GitRepo};
3131

@@ -53,6 +53,15 @@ fn new_cc_build(build: &Build, target: TargetSelection) -> cc::Build {
5353
}
5454
}
5555
}
56+
match build.config.rust_lto {
57+
RustcLto::Off | RustcLto::ThinLocal => {}
58+
RustcLto::Thin => {
59+
cfg.flag_if_supported("-flto=thin");
60+
}
61+
RustcLto::Fat => {
62+
cfg.flag_if_supported("-flto=full");
63+
}
64+
}
5665
cfg
5766
}
5867

@@ -113,7 +122,7 @@ pub fn fill_target_compiler(build: &mut Build, target: TargetSelection) {
113122
};
114123

115124
build.cc.insert(target, compiler.clone());
116-
let mut cflags = build.cc_handled_clags(target, CLang::C);
125+
let mut cflags = build.cc_handled_cflags(target, CLang::C);
117126
cflags.extend(build.cc_unhandled_cflags(target, GitRepo::Rustc, CLang::C));
118127

119128
// If we use llvm-libunwind, we will need a C++ compiler as well for all targets
@@ -140,7 +149,7 @@ pub fn fill_target_compiler(build: &mut Build, target: TargetSelection) {
140149
build.do_if_verbose(|| println!("CC_{} = {:?}", target.triple, build.cc(target)));
141150
build.do_if_verbose(|| println!("CFLAGS_{} = {cflags:?}", target.triple));
142151
if let Ok(cxx) = build.cxx(target) {
143-
let mut cxxflags = build.cc_handled_clags(target, CLang::Cxx);
152+
let mut cxxflags = build.cc_handled_cflags(target, CLang::Cxx);
144153
cxxflags.extend(build.cc_unhandled_cflags(target, GitRepo::Rustc, CLang::Cxx));
145154
build.do_if_verbose(|| println!("CXX_{} = {cxx:?}", target.triple));
146155
build.do_if_verbose(|| println!("CXXFLAGS_{} = {cxxflags:?}", target.triple));

0 commit comments

Comments
 (0)