File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -2605,12 +2605,17 @@ impl Build {
26052605 } else if self . get_host ( ) ? != target {
26062606 match self . prefix_for_target ( & target) {
26072607 Some ( p) => {
2608- let target_ar = format ! ( "{}-gcc-ar" , p) ;
2609- if Command :: new ( & target_ar) . output ( ) . is_ok ( ) {
2610- target_ar
2611- } else {
2612- default_ar
2608+ // GCC uses $target-gcc-ar, whereas binutils uses $target-ar -- try both.
2609+ // Prefer -gcc-ar if it exists, since that matches what we'll use for $CC.
2610+ let mut ar = default_ar;
2611+ for & infix in & [ "-gcc" , "" ] {
2612+ let target_ar = format ! ( "{}{}-ar" , p, infix) ;
2613+ if Command :: new ( & target_ar) . output ( ) . is_ok ( ) {
2614+ ar = target_ar;
2615+ break ;
2616+ }
26132617 }
2618+ ar
26142619 }
26152620 None => default_ar,
26162621 }
You can’t perform that action at this time.
0 commit comments