@@ -140,7 +140,6 @@ impl SysrootTarget {
140140static STDLIB_SRC : RelPath = RelPath :: build ( "stdlib" ) ;
141141static STANDARD_LIBRARY : CargoProject =
142142 CargoProject :: new ( & RelPath :: build ( "stdlib/library/sysroot" ) , "stdlib_target" ) ;
143- static RTSTARTUP_SYSROOT : RelPath = RelPath :: build ( "rtstartup" ) ;
144143
145144fn build_sysroot_for_triple (
146145 dirs : & Dirs ,
@@ -150,8 +149,7 @@ fn build_sysroot_for_triple(
150149 panic_unwind_support : bool ,
151150) -> SysrootTarget {
152151 match sysroot_kind {
153- SysrootKind :: None => build_rtstartup ( dirs, & compiler)
154- . unwrap_or ( SysrootTarget { triple : compiler. triple , libs : vec ! [ ] } ) ,
152+ SysrootKind :: None => SysrootTarget { triple : compiler. triple , libs : vec ! [ ] } ,
155153 SysrootKind :: Llvm => build_llvm_sysroot_for_triple ( compiler) ,
156154 SysrootKind :: Clif => {
157155 build_clif_sysroot_for_triple ( dirs, compiler, cg_clif_dylib_path, panic_unwind_support)
@@ -201,15 +199,14 @@ fn build_clif_sysroot_for_triple(
201199) -> SysrootTarget {
202200 let mut target_libs = SysrootTarget { triple : compiler. triple . clone ( ) , libs : vec ! [ ] } ;
203201
204- if let Some ( rtstartup_target_libs) = build_rtstartup ( dirs, & compiler) {
205- rtstartup_target_libs. install_into_sysroot ( & RTSTARTUP_SYSROOT . to_path ( dirs) ) ;
206-
207- target_libs. libs . extend ( rtstartup_target_libs. libs ) ;
208- }
209-
210202 let build_dir = STANDARD_LIBRARY . target_dir ( dirs) . join ( & compiler. triple ) . join ( "release" ) ;
211203
212204 if !config:: get_bool ( "keep_sysroot" ) {
205+ let sysroot_src_orig = get_default_sysroot ( & compiler. rustc ) . join ( "lib/rustlib/src/rust" ) ;
206+ assert ! ( sysroot_src_orig. exists( ) ) ;
207+
208+ apply_patches ( dirs, "stdlib" , & sysroot_src_orig, & STDLIB_SRC . to_path ( dirs) ) ;
209+
213210 // Cleanup the deps dir, but keep build scripts and the incremental cache for faster
214211 // recompilation as they are not affected by changes in cg_clif.
215212 ensure_empty_dir ( & build_dir. join ( "deps" ) ) ;
@@ -228,9 +225,7 @@ fn build_clif_sysroot_for_triple(
228225 rustflags. push ( format ! ( "-Zcodegen-backend={name}" ) ) ;
229226 }
230227 } ;
231- // Necessary for MinGW to find rsbegin.o and rsend.o
232- rustflags. push ( "--sysroot" . to_owned ( ) ) ;
233- rustflags. push ( RTSTARTUP_SYSROOT . to_path ( dirs) . to_str ( ) . unwrap ( ) . to_owned ( ) ) ;
228+ rustflags. push ( "--sysroot=/dev/null" . to_owned ( ) ) ;
234229
235230 // Incremental compilation by default disables mir inlining. This leads to both a decent
236231 // compile perf and a significant runtime perf regression. As such forcefully enable mir
@@ -271,38 +266,3 @@ fn build_clif_sysroot_for_triple(
271266
272267 target_libs
273268}
274-
275- fn build_rtstartup ( dirs : & Dirs , compiler : & Compiler ) -> Option < SysrootTarget > {
276- if !config:: get_bool ( "keep_sysroot" ) {
277- let sysroot_src_orig = get_default_sysroot ( & compiler. rustc ) . join ( "lib/rustlib/src/rust" ) ;
278- assert ! ( sysroot_src_orig. exists( ) ) ;
279-
280- apply_patches ( dirs, "stdlib" , & sysroot_src_orig, & STDLIB_SRC . to_path ( dirs) ) ;
281- }
282-
283- if !compiler. triple . ends_with ( "windows-gnu" ) {
284- return None ;
285- }
286-
287- let rtstartup_sysroot = RTSTARTUP_SYSROOT . to_path ( dirs) ;
288- ensure_empty_dir ( & rtstartup_sysroot) ;
289-
290- let rtstartup_src = STDLIB_SRC . to_path ( dirs) . join ( "library" ) . join ( "rtstartup" ) ;
291- let mut target_libs = SysrootTarget { triple : compiler. triple . clone ( ) , libs : vec ! [ ] } ;
292-
293- for file in [ "rsbegin" , "rsend" ] {
294- let obj = rtstartup_sysroot. join ( format ! ( "{file}.o" ) ) ;
295- let mut build_rtstartup_cmd = Command :: new ( & compiler. rustc ) ;
296- build_rtstartup_cmd
297- . arg ( "--target" )
298- . arg ( & compiler. triple )
299- . arg ( "--emit=obj" )
300- . arg ( "-o" )
301- . arg ( & obj)
302- . arg ( rtstartup_src. join ( format ! ( "{file}.rs" ) ) ) ;
303- spawn_and_wait ( build_rtstartup_cmd) ;
304- target_libs. libs . push ( obj. clone ( ) ) ;
305- }
306-
307- Some ( target_libs)
308- }
0 commit comments