@@ -1010,14 +1010,18 @@ impl Step for Rustc {
10101010 // our LLVM wrapper. Unless we're explicitly requesting `librustc_driver` to be built with
10111011 // debuginfo (via the debuginfo level of the executables using it): strip this debuginfo
10121012 // away after the fact.
1013+ let target_root_dir = stamp. parent ( ) . unwrap ( ) ;
10131014 if builder. config . rust_debuginfo_level_rustc == DebuginfoLevel :: None
10141015 && builder. config . rust_debuginfo_level_tools == DebuginfoLevel :: None
10151016 {
1016- let target_root_dir = stamp. parent ( ) . unwrap ( ) ;
10171017 let rustc_driver = target_root_dir. join ( "librustc_driver.so" ) ;
10181018 strip_debug ( builder, target, & rustc_driver) ;
10191019 }
10201020
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+
10211025 builder. ensure ( RustcLink :: from_rustc (
10221026 self ,
10231027 builder. compiler ( compiler. stage , builder. config . build ) ,
@@ -2291,7 +2295,14 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
22912295 }
22922296
22932297 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+ }
22952306
22962307 let file = t ! ( fs:: File :: open( path) ) ;
22972308
0 commit comments