File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -2547,11 +2547,12 @@ impl Build {
2547
2547
}
2548
2548
2549
2549
fn prefix_for_target ( & self , target : & str ) -> Option < String > {
2550
+ // Put aside RUSTC_LINKER's prefix to be used as last resort
2551
+ let rustc_linker = self . getenv ( "RUSTC_LINKER" ) . unwrap_or ( "" . to_string ( ) ) ;
2552
+ let linker_prefix = rustc_linker. strip_suffix ( "-gcc" ) ;
2550
2553
// CROSS_COMPILE is of the form: "arm-linux-gnueabi-"
2551
2554
let cc_env = self . getenv ( "CROSS_COMPILE" ) ;
2552
- let cross_compile = cc_env
2553
- . as_ref ( )
2554
- . map ( |s| s. trim_right_matches ( '-' ) . to_owned ( ) ) ;
2555
+ let cross_compile = cc_env. as_ref ( ) . map ( |s| s. trim_end_matches ( '-' ) . to_owned ( ) ) ;
2555
2556
cross_compile. or ( match & target[ ..] {
2556
2557
"aarch64-pc-windows-gnu" => Some ( "aarch64-w64-mingw32" ) ,
2557
2558
"aarch64-uwp-windows-gnu" => Some ( "aarch64-w64-mingw32" ) ,
@@ -2658,7 +2659,7 @@ impl Build {
2658
2659
] ) , // explicit None if not found, so caller knows to fall back
2659
2660
"x86_64-unknown-linux-musl" => Some ( "musl" ) ,
2660
2661
"x86_64-unknown-netbsd" => Some ( "x86_64--netbsd" ) ,
2661
- _ => None ,
2662
+ _ => linker_prefix ,
2662
2663
}
2663
2664
. map ( |x| x. to_owned ( ) ) )
2664
2665
}
You can’t perform that action at this time.
0 commit comments