@@ -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( ) )
@@ -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