@@ -16,6 +16,8 @@ use std::{env, fs};
1616
1717use object::BinaryFormat;
1818use object::read::archive::ArchiveFile;
19+ #[cfg(feature = "tracing")]
20+ use tracing::instrument;
1921
2022use crate::core::build_steps::doc::DocumentationFormat;
2123use crate::core::build_steps::tool::{self, Tool};
@@ -30,7 +32,7 @@ use crate::utils::helpers::{
3032 exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit,
3133};
3234use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
33- use crate::{Compiler, DependencyType, LLVM_TOOLS, Mode};
35+ use crate::{Compiler, DependencyType, LLVM_TOOLS, Mode, trace };
3436
3537pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
3638 format!("{}-{}", component, builder.rust_package_vers())
@@ -582,7 +584,7 @@ impl Step for DebuggerScripts {
582584fn skip_host_target_lib(builder: &Builder<'_>, compiler: Compiler) -> bool {
583585 // The only true set of target libraries came from the build triple, so
584586 // let's reduce redundant work by only producing archives from that host.
585- if !builder.is_builder_target(& compiler.host) {
587+ if !builder.is_builder_target(compiler.host) {
586588 builder.info("\tskipping, not a build host");
587589 true
588590 } else {
@@ -637,7 +639,7 @@ fn copy_target_libs(
637639 for (path, dependency_type) in builder.read_stamp_file(stamp) {
638640 if dependency_type == DependencyType::TargetSelfContained {
639641 builder.copy_link(&path, &self_contained_dst.join(path.file_name().unwrap()));
640- } else if dependency_type == DependencyType::Target || builder.is_builder_target(& target) {
642+ } else if dependency_type == DependencyType::Target || builder.is_builder_target(target) {
641643 builder.copy_link(&path, &dst.join(path.file_name().unwrap()));
642644 }
643645 }
@@ -786,7 +788,7 @@ impl Step for Analysis {
786788 fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> {
787789 let compiler = self.compiler;
788790 let target = self.target;
789- if !builder.is_builder_target(& compiler.host) {
791+ if !builder.is_builder_target(compiler.host) {
790792 return None;
791793 }
792794
@@ -2029,6 +2031,15 @@ fn install_llvm_file(
20292031/// Maybe add LLVM object files to the given destination lib-dir. Allows either static or dynamic linking.
20302032///
20312033/// Returns whether the files were actually copied.
2034+ #[cfg_attr(
2035+ feature = "tracing",
2036+ instrument(
2037+ level = "trace",
2038+ name = "maybe_install_llvm",
2039+ skip_all,
2040+ fields(target = ?target, dst_libdir = ?dst_libdir, install_symlink = install_symlink),
2041+ ),
2042+ )]
20322043fn maybe_install_llvm(
20332044 builder: &Builder<'_>,
20342045 target: TargetSelection,
@@ -2052,6 +2063,7 @@ fn maybe_install_llvm(
20522063 // If the LLVM is coming from ourselves (just from CI) though, we
20532064 // still want to install it, as it otherwise won't be available.
20542065 if builder.is_system_llvm(target) {
2066+ trace!("system LLVM requested, no install");
20552067 return false;
20562068 }
20572069
@@ -2070,6 +2082,7 @@ fn maybe_install_llvm(
20702082 } else if let llvm::LlvmBuildStatus::AlreadyBuilt(llvm::LlvmResult { llvm_config, .. }) =
20712083 llvm::prebuilt_llvm_config(builder, target, true)
20722084 {
2085+ trace!("LLVM already built, installing LLVM files");
20732086 let mut cmd = command(llvm_config);
20742087 cmd.arg("--libfiles");
20752088 builder.verbose(|| println!("running {cmd:?}"));
@@ -2092,6 +2105,19 @@ fn maybe_install_llvm(
20922105}
20932106
20942107/// Maybe add libLLVM.so to the target lib-dir for linking.
2108+ #[cfg_attr(
2109+ feature = "tracing",
2110+ instrument(
2111+ level = "trace",
2112+ name = "maybe_install_llvm_target",
2113+ skip_all,
2114+ fields(
2115+ llvm_link_shared = ?builder.llvm_link_shared(),
2116+ target = ?target,
2117+ sysroot = ?sysroot,
2118+ ),
2119+ ),
2120+ )]
20952121pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) {
20962122 let dst_libdir = sysroot.join("lib/rustlib").join(target).join("lib");
20972123 // We do not need to copy LLVM files into the sysroot if it is not
@@ -2103,6 +2129,19 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection,
21032129}
21042130
21052131/// Maybe add libLLVM.so to the runtime lib-dir for rustc itself.
2132+ #[cfg_attr(
2133+ feature = "tracing",
2134+ instrument(
2135+ level = "trace",
2136+ name = "maybe_install_llvm_runtime",
2137+ skip_all,
2138+ fields(
2139+ llvm_link_shared = ?builder.llvm_link_shared(),
2140+ target = ?target,
2141+ sysroot = ?sysroot,
2142+ ),
2143+ ),
2144+ )]
21062145pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) {
21072146 let dst_libdir =
21082147 sysroot.join(builder.sysroot_libdir_relative(Compiler { stage: 1, host: target }));
0 commit comments