File tree 3 files changed +13
-10
lines changed
3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -758,7 +758,7 @@ impl<'a> Builder<'a> {
758
758
if let Some ( linker) = self . linker ( compiler. host ) {
759
759
cmd. env ( "RUSTDOC_LINKER" , linker) ;
760
760
}
761
- if self . config . use_lld && ! compiler. host . contains ( "msvc" ) {
761
+ if self . is_fuse_ld_lld ( compiler. host ) {
762
762
cmd. env ( "RUSTDOC_FUSE_LD_LLD" , "1" ) ;
763
763
}
764
764
cmd
@@ -1047,16 +1047,15 @@ impl<'a> Builder<'a> {
1047
1047
if let Some ( host_linker) = self . linker ( compiler. host ) {
1048
1048
cargo. env ( "RUSTC_HOST_LINKER" , host_linker) ;
1049
1049
}
1050
- if self . config . use_lld && ! compiler. host . contains ( "msvc" ) {
1050
+ if self . is_fuse_ld_lld ( compiler. host ) {
1051
1051
cargo. env ( "RUSTC_HOST_FUSE_LD_LLD" , "1" ) ;
1052
1052
}
1053
1053
1054
1054
if let Some ( target_linker) = self . linker ( target) {
1055
1055
let target = crate :: envify ( & target. triple ) ;
1056
1056
cargo. env ( & format ! ( "CARGO_TARGET_{}_LINKER" , target) , target_linker) ;
1057
1057
}
1058
-
1059
- if self . config . use_lld && !target. contains ( "msvc" ) {
1058
+ if self . is_fuse_ld_lld ( target) {
1060
1059
rustflags. arg ( "-Clink-args=-fuse-ld=lld" ) ;
1061
1060
}
1062
1061
Original file line number Diff line number Diff line change @@ -863,15 +863,19 @@ impl Build {
863
863
&& !target. contains ( "msvc" )
864
864
{
865
865
Some ( self . cc ( target) )
866
- } else if target. contains ( "msvc" ) && self . config . use_lld && self . build == target {
867
- // `rust.use_lld` means using LLD directly only for MSVC, for other targets it only
868
- // adds `-fuse-ld=lld` to already selected linker.
866
+ } else if self . config . use_lld && !self . is_fuse_ld_lld ( target) && self . build == target {
869
867
Some ( & self . initial_lld )
870
868
} else {
871
869
None
872
870
}
873
871
}
874
872
873
+ // LLD is used through `-fuse-ld=lld` rather than directly.
874
+ // Only MSVC targets use LLD directly at the moment.
875
+ fn is_fuse_ld_lld ( & self , target : TargetSelection ) -> bool {
876
+ self . config . use_lld && !target. contains ( "msvc" )
877
+ }
878
+
875
879
/// Returns if this target should statically link the C runtime, if specified
876
880
fn crt_static ( & self , target : TargetSelection ) -> Option < bool > {
877
881
if target. contains ( "pc-windows-msvc" ) {
Original file line number Diff line number Diff line change @@ -603,7 +603,7 @@ impl Step for RustdocTheme {
603
603
if let Some ( linker) = builder. linker ( self . compiler . host ) {
604
604
cmd. env ( "RUSTDOC_LINKER" , linker) ;
605
605
}
606
- if builder. config . use_lld && ! self . compiler . host . contains ( "msvc" ) {
606
+ if builder. is_fuse_ld_lld ( self . compiler . host ) {
607
607
cmd. env ( "RUSTDOC_FUSE_LD_LLD" , "1" ) ;
608
608
}
609
609
try_run ( builder, & mut cmd) ;
@@ -1070,14 +1070,14 @@ impl Step for Compiletest {
1070
1070
1071
1071
let mut hostflags = flags. clone ( ) ;
1072
1072
hostflags. push ( format ! ( "-Lnative={}" , builder. test_helpers_out( compiler. host) . display( ) ) ) ;
1073
- if builder. config . use_lld && ! compiler. host . triple . contains ( "msvc" ) {
1073
+ if builder. is_fuse_ld_lld ( compiler. host ) {
1074
1074
hostflags. push ( "-Clink-args=-fuse-ld=lld" . to_string ( ) ) ;
1075
1075
}
1076
1076
cmd. arg ( "--host-rustcflags" ) . arg ( hostflags. join ( " " ) ) ;
1077
1077
1078
1078
let mut targetflags = flags;
1079
1079
targetflags. push ( format ! ( "-Lnative={}" , builder. test_helpers_out( target) . display( ) ) ) ;
1080
- if builder. config . use_lld && !target . contains ( "msvc" ) {
1080
+ if builder. is_fuse_ld_lld ( target ) {
1081
1081
targetflags. push ( "-Clink-args=-fuse-ld=lld" . to_string ( ) ) ;
1082
1082
}
1083
1083
cmd. arg ( "--target-rustcflags" ) . arg ( targetflags. join ( " " ) ) ;
You can’t perform that action at this time.
0 commit comments