From 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:43 +0200 Subject: Merging upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- src/bootstrap/compile.rs | 130 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 95 insertions(+), 35 deletions(-) (limited to 'src/bootstrap/compile.rs') diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 68d1db016..8b80dfc0f 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -16,7 +16,7 @@ use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use std::str; -use serde::Deserialize; +use serde_derive::Deserialize; use crate::builder::crate_description; use crate::builder::Cargo; @@ -111,10 +111,18 @@ impl Step for Std { let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); if compiler_to_use != compiler { builder.ensure(Std::new(compiler_to_use, target)); - builder.info(&format!( - "Uplifting stage1 library ({} -> {})", - compiler_to_use.host, target - )); + let msg = if compiler_to_use.host == target { + format!( + "Uplifting library (stage{} -> stage{})", + compiler_to_use.stage, compiler.stage + ) + } else { + format!( + "Uplifting library (stage{}:{} -> stage{}:{})", + compiler_to_use.stage, compiler_to_use.host, compiler.stage, target + ) + }; + builder.info(&msg); // Even if we're not building std this stage, the new sysroot must // still contain the third party objects needed by various targets. @@ -134,13 +142,23 @@ impl Step for Std { cargo.arg("-p").arg(krate); } - builder.info(&format!( - "Building{} stage{} library artifacts ({} -> {})", - crate_description(&self.crates), - compiler.stage, - &compiler.host, - target, - )); + let msg = if compiler.host == target { + format!( + "Building{} stage{} library artifacts ({}) ", + crate_description(&self.crates), + compiler.stage, + compiler.host + ) + } else { + format!( + "Building{} stage{} library artifacts ({} -> {})", + crate_description(&self.crates), + compiler.stage, + compiler.host, + target, + ) + }; + builder.info(&msg); run_cargo( builder, cargo, @@ -379,6 +397,9 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car if stage >= 1 { cargo.rustflag("-Cembed-bitcode=yes"); } + if builder.config.rust_lto == RustcLto::Off { + cargo.rustflag("-Clto=off"); + } // By default, rustc does not include unwind tables unless they are required // for a particular target. They are not required by RISC-V targets, but @@ -435,10 +456,6 @@ impl Step for StdLink { let compiler = self.compiler; let target_compiler = self.target_compiler; let target = self.target; - builder.info(&format!( - "Copying stage{} library from stage{} ({} -> {} / {})", - target_compiler.stage, compiler.stage, &compiler.host, target_compiler.host, target - )); let libdir = builder.sysroot_libdir(target_compiler, target); let hostdir = builder.sysroot_libdir(target_compiler, compiler.host); add_to_sysroot(builder, &libdir, &hostdir, &libstd_stamp(builder, compiler, target)); @@ -464,7 +481,12 @@ fn copy_sanitizers( let dst = libdir.join(&runtime.name); builder.copy(&runtime.path, &dst); - if target == "x86_64-apple-darwin" || target == "aarch64-apple-darwin" { + if target == "x86_64-apple-darwin" + || target == "aarch64-apple-darwin" + || target == "aarch64-apple-ios" + || target == "aarch64-apple-ios-sim" + || target == "x86_64-apple-ios" + { // Update the library’s install name to reflect that it has been renamed. apple_darwin_update_library_name(&dst, &format!("@rpath/{}", &runtime.name)); // Upon renaming the install name, the code signature of the file will invalidate, @@ -641,8 +663,22 @@ impl Step for Rustc { let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); if compiler_to_use != compiler { builder.ensure(Rustc::new(compiler_to_use, target)); - builder - .info(&format!("Uplifting stage1 rustc ({} -> {})", builder.config.build, target)); + let msg = if compiler_to_use.host == target { + format!( + "Uplifting rustc (stage{} -> stage{})", + compiler_to_use.stage, + compiler.stage + 1 + ) + } else { + format!( + "Uplifting rustc (stage{}:{} -> stage{}:{})", + compiler_to_use.stage, + compiler_to_use.host, + compiler.stage + 1, + target + ) + }; + builder.info(&msg); builder.ensure(RustcLink::from_rustc(self, compiler_to_use)); return; } @@ -722,6 +758,13 @@ impl Step for Rustc { cargo.rustflag("-Cembed-bitcode=yes"); } RustcLto::ThinLocal => { /* Do nothing, this is the default */ } + RustcLto::Off => { + cargo.rustflag("-Clto=off"); + } + } + } else { + if builder.config.rust_lto == RustcLto::Off { + cargo.rustflag("-Clto=off"); } } @@ -729,13 +772,24 @@ impl Step for Rustc { cargo.arg("-p").arg(krate); } - builder.info(&format!( - "Building{} stage{} compiler artifacts ({} -> {})", - crate_description(&self.crates), - compiler.stage, - &compiler.host, - target, - )); + let msg = if compiler.host == target { + format!( + "Building{} compiler artifacts (stage{} -> stage{})", + crate_description(&self.crates), + compiler.stage, + compiler.stage + 1 + ) + } else { + format!( + "Building{} compiler artifacts (stage{}:{} -> stage{}:{})", + crate_description(&self.crates), + compiler.stage, + compiler.host, + compiler.stage + 1, + target, + ) + }; + builder.info(&msg); run_cargo( builder, cargo, @@ -919,10 +973,6 @@ impl Step for RustcLink { let compiler = self.compiler; let target_compiler = self.target_compiler; let target = self.target; - builder.info(&format!( - "Copying stage{} rustc from stage{} ({} -> {} / {})", - target_compiler.stage, compiler.stage, &compiler.host, target_compiler.host, target - )); add_to_sysroot( builder, &builder.sysroot_libdir(target_compiler, target), @@ -996,10 +1046,15 @@ impl Step for CodegenBackend { let tmp_stamp = out_dir.join(".tmp.stamp"); - builder.info(&format!( - "Building stage{} codegen backend {} ({} -> {})", - compiler.stage, backend, &compiler.host, target - )); + let msg = if compiler.host == target { + format!("Building stage{} codegen backend {}", compiler.stage, backend) + } else { + format!( + "Building stage{} codegen backend {} ({} -> {})", + compiler.stage, backend, compiler.host, target + ) + }; + builder.info(&msg); let files = run_cargo(builder, cargo, vec![], &tmp_stamp, vec![], false, false); if builder.config.dry_run() { return; @@ -1305,7 +1360,12 @@ impl Step for Assemble { let stage = target_compiler.stage; let host = target_compiler.host; - builder.info(&format!("Assembling stage{} compiler ({})", stage, host)); + let msg = if build_compiler.host == host { + format!("Assembling stage{} compiler", stage) + } else { + format!("Assembling stage{} compiler ({})", stage, host) + }; + builder.info(&msg); // Link in all dylibs to the libdir let stamp = librustc_stamp(builder, build_compiler, target_compiler.host); -- cgit v1.2.3