@@ -140,7 +140,6 @@ impl SysrootTarget {
140
140
static STDLIB_SRC : RelPath = RelPath :: build ( "stdlib" ) ;
141
141
static STANDARD_LIBRARY : CargoProject =
142
142
CargoProject :: new ( & RelPath :: build ( "stdlib/library/sysroot" ) , "stdlib_target" ) ;
143
- static RTSTARTUP_SYSROOT : RelPath = RelPath :: build ( "rtstartup" ) ;
144
143
145
144
fn build_sysroot_for_triple (
146
145
dirs : & Dirs ,
@@ -150,8 +149,7 @@ fn build_sysroot_for_triple(
150
149
panic_unwind_support : bool ,
151
150
) -> SysrootTarget {
152
151
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 ! [ ] } ,
155
153
SysrootKind :: Llvm => build_llvm_sysroot_for_triple ( compiler) ,
156
154
SysrootKind :: Clif => {
157
155
build_clif_sysroot_for_triple ( dirs, compiler, cg_clif_dylib_path, panic_unwind_support)
@@ -201,15 +199,14 @@ fn build_clif_sysroot_for_triple(
201
199
) -> SysrootTarget {
202
200
let mut target_libs = SysrootTarget { triple : compiler. triple . clone ( ) , libs : vec ! [ ] } ;
203
201
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
-
210
202
let build_dir = STANDARD_LIBRARY . target_dir ( dirs) . join ( & compiler. triple ) . join ( "release" ) ;
211
203
212
204
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
+
213
210
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster
214
211
// recompilation as they are not affected by changes in cg_clif.
215
212
ensure_empty_dir ( & build_dir. join ( "deps" ) ) ;
@@ -228,9 +225,7 @@ fn build_clif_sysroot_for_triple(
228
225
rustflags. push ( format ! ( "-Zcodegen-backend={name}" ) ) ;
229
226
}
230
227
} ;
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 ( ) ) ;
234
229
235
230
// Incremental compilation by default disables mir inlining. This leads to both a decent
236
231
// compile perf and a significant runtime perf regression. As such forcefully enable mir
@@ -271,38 +266,3 @@ fn build_clif_sysroot_for_triple(
271
266
272
267
target_libs
273
268
}
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