@@ -1306,29 +1306,35 @@ impl Build {
13061306 } ;
13071307 }
13081308
1309- // For tests we want to use only a single thread .
1309+ // For tests, we want to disable multi-threading .
13101310 // If we use an external LLD, we don't know if it's new enough to support the required
13111311 // threads flag. Therefore we invoke it to find it out.
13121312 // The self-contained lld should always be new enough.
13131313 if test {
1314- let new_flags = if let LldMode :: External = self . config . lld_mode {
1315- util:: is_lld_newer_than_10 ( )
1316- } else {
1317- true
1318- } ;
1319-
1320- let flag = match ( new_flags, target. contains ( "windows" ) ) {
1321- ( true , true ) => "/threads:1" ,
1322- ( true , false ) => "--threads=1" ,
1323- ( false , true ) => "/no-threads" ,
1324- ( false , false ) => "--no-threads" ,
1325- } ;
1314+ let flag = self . lld_single_thread_flag ( target) ;
13261315 flags. push ( format ! ( "-Clink-arg=-Wl,{flag}" ) ) ;
13271316 }
13281317
13291318 flags
13301319 }
13311320
1321+ /// Returns the LLD flag to disable multi-threading based on the given target
1322+ /// and lld version.
1323+ fn lld_single_thread_flag ( & self , target : TargetSelection ) -> & ' static str {
1324+ let new_flags = if let LldMode :: External = self . config . lld_mode {
1325+ util:: is_lld_newer_than_10 ( )
1326+ } else {
1327+ true
1328+ } ;
1329+
1330+ match ( new_flags, target. contains ( "windows" ) ) {
1331+ ( true , true ) => "/threads:1" ,
1332+ ( true , false ) => "--threads=1" ,
1333+ ( false , true ) => "/no-threads" ,
1334+ ( false , false ) => "--no-threads" ,
1335+ }
1336+ }
1337+
13321338 /// Returns if this target should statically link the C runtime, if specified
13331339 fn crt_static ( & self , target : TargetSelection ) -> Option < bool > {
13341340 if target. contains ( "pc-windows-msvc" ) {
0 commit comments