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 {
2605
2605
} else if self . get_host ( ) ? != target {
2606
2606
match self . prefix_for_target ( & target) {
2607
2607
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
+ }
2613
2617
}
2618
+ ar
2614
2619
}
2615
2620
None => default_ar,
2616
2621
}
You can’t perform that action at this time.
0 commit comments