@@ -1010,14 +1010,18 @@ impl Step for Rustc {
1010
1010
// our LLVM wrapper. Unless we're explicitly requesting `librustc_driver` to be built with
1011
1011
// debuginfo (via the debuginfo level of the executables using it): strip this debuginfo
1012
1012
// away after the fact.
1013
+ let target_root_dir = stamp. parent ( ) . unwrap ( ) ;
1013
1014
if builder. config . rust_debuginfo_level_rustc == DebuginfoLevel :: None
1014
1015
&& builder. config . rust_debuginfo_level_tools == DebuginfoLevel :: None
1015
1016
{
1016
- let target_root_dir = stamp. parent ( ) . unwrap ( ) ;
1017
1017
let rustc_driver = target_root_dir. join ( "librustc_driver.so" ) ;
1018
1018
strip_debug ( builder, target, & rustc_driver) ;
1019
1019
}
1020
1020
1021
+ // Due to LTO a lot of debug info from C++ dependencies such as jemalloc can make it into
1022
+ // our final binaries
1023
+ strip_debug ( builder, target, & target_root_dir. join ( "rustc-main" ) ) ;
1024
+
1021
1025
builder. ensure ( RustcLink :: from_rustc (
1022
1026
self ,
1023
1027
builder. compiler ( compiler. stage , builder. config . build ) ,
@@ -2291,7 +2295,14 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
2291
2295
}
2292
2296
2293
2297
let previous_mtime = t ! ( t!( path. metadata( ) ) . modified( ) ) ;
2294
- command ( "strip" ) . arg ( "--strip-debug" ) . arg ( path) . run_capture ( builder) ;
2298
+ let result = command ( "strip" ) . arg ( "--strip-debug" ) . arg ( path) . run_capture ( builder) ;
2299
+ if result. is_failure ( ) {
2300
+ eprintln ! (
2301
+ "warning: `strip --strip-debug {}` failed: `{}`" ,
2302
+ path. display( ) ,
2303
+ result. stderr( )
2304
+ ) ;
2305
+ }
2295
2306
2296
2307
let file = t ! ( fs:: File :: open( path) ) ;
2297
2308
0 commit comments