@@ -16,6 +16,8 @@ use std::{env, fs};
16
16
17
17
use object:: BinaryFormat ;
18
18
use object:: read:: archive:: ArchiveFile ;
19
+ #[ cfg( feature = "tracing" ) ]
20
+ use tracing:: instrument;
19
21
20
22
use crate :: core:: build_steps:: doc:: DocumentationFormat ;
21
23
use crate :: core:: build_steps:: tool:: { self , Tool } ;
@@ -30,7 +32,7 @@ use crate::utils::helpers::{
30
32
exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit,
31
33
} ;
32
34
use crate :: utils:: tarball:: { GeneratedTarball , OverlayKind , Tarball } ;
33
- use crate :: { Compiler , DependencyType , LLVM_TOOLS , Mode } ;
35
+ use crate :: { Compiler , DependencyType , LLVM_TOOLS , Mode , trace } ;
34
36
35
37
pub fn pkgname ( builder : & Builder < ' _ > , component : & str ) -> String {
36
38
format ! ( "{}-{}" , component, builder. rust_package_vers( ) )
@@ -582,7 +584,7 @@ impl Step for DebuggerScripts {
582
584
fn skip_host_target_lib ( builder : & Builder < ' _ > , compiler : Compiler ) -> bool {
583
585
// The only true set of target libraries came from the build triple, so
584
586
// 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 ) {
586
588
builder. info ( "\t skipping, not a build host" ) ;
587
589
true
588
590
} else {
@@ -637,7 +639,7 @@ fn copy_target_libs(
637
639
for ( path, dependency_type) in builder. read_stamp_file ( stamp) {
638
640
if dependency_type == DependencyType :: TargetSelfContained {
639
641
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) {
641
643
builder. copy_link ( & path, & dst. join ( path. file_name ( ) . unwrap ( ) ) ) ;
642
644
}
643
645
}
@@ -786,7 +788,7 @@ impl Step for Analysis {
786
788
fn run ( self , builder : & Builder < ' _ > ) -> Option < GeneratedTarball > {
787
789
let compiler = self . compiler ;
788
790
let target = self . target ;
789
- if !builder. is_builder_target ( & compiler. host ) {
791
+ if !builder. is_builder_target ( compiler. host ) {
790
792
return None ;
791
793
}
792
794
@@ -2029,6 +2031,15 @@ fn install_llvm_file(
2029
2031
/// Maybe add LLVM object files to the given destination lib-dir. Allows either static or dynamic linking.
2030
2032
///
2031
2033
/// 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
+ ) ]
2032
2043
fn maybe_install_llvm (
2033
2044
builder : & Builder < ' _ > ,
2034
2045
target : TargetSelection ,
@@ -2052,6 +2063,7 @@ fn maybe_install_llvm(
2052
2063
// If the LLVM is coming from ourselves (just from CI) though, we
2053
2064
// still want to install it, as it otherwise won't be available.
2054
2065
if builder. is_system_llvm ( target) {
2066
+ trace ! ( "system LLVM requested, no install" ) ;
2055
2067
return false ;
2056
2068
}
2057
2069
@@ -2070,6 +2082,7 @@ fn maybe_install_llvm(
2070
2082
} else if let llvm:: LlvmBuildStatus :: AlreadyBuilt ( llvm:: LlvmResult { llvm_config, .. } ) =
2071
2083
llvm:: prebuilt_llvm_config ( builder, target, true )
2072
2084
{
2085
+ trace ! ( "LLVM already built, installing LLVM files" ) ;
2073
2086
let mut cmd = command ( llvm_config) ;
2074
2087
cmd. arg ( "--libfiles" ) ;
2075
2088
builder. verbose ( || println ! ( "running {cmd:?}" ) ) ;
@@ -2092,6 +2105,19 @@ fn maybe_install_llvm(
2092
2105
}
2093
2106
2094
2107
/// 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
+ ) ]
2095
2121
pub fn maybe_install_llvm_target ( builder : & Builder < ' _ > , target : TargetSelection , sysroot : & Path ) {
2096
2122
let dst_libdir = sysroot. join ( "lib/rustlib" ) . join ( target) . join ( "lib" ) ;
2097
2123
// 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,
2103
2129
}
2104
2130
2105
2131
/// 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
+ ) ]
2106
2145
pub fn maybe_install_llvm_runtime ( builder : & Builder < ' _ > , target : TargetSelection , sysroot : & Path ) {
2107
2146
let dst_libdir =
2108
2147
sysroot. join ( builder. sysroot_libdir_relative ( Compiler { stage : 1 , host : target } ) ) ;
0 commit comments