@@ -2104,29 +2104,29 @@ impl Build {
21042104 let mut parts = target. split ( '-' ) ;
21052105 if let Some ( arch) = parts. next ( ) {
21062106 let arch = & arch[ 5 ..] ;
2107- if target. contains ( "linux" ) && arch. starts_with ( "64" ) {
2108- cmd. args . push ( ( "-march=rv64gc" ) . into ( ) ) ;
2109- cmd. args . push ( "-mabi=lp64d" . into ( ) ) ;
2110- } else if target. contains ( "freebsd" ) && arch. starts_with ( "64" ) {
2111- cmd. args . push ( ( "-march=rv64gc" ) . into ( ) ) ;
2112- cmd. args . push ( "-mabi=lp64d" . into ( ) ) ;
2113- } else if target. contains ( "netbsd" ) && arch. starts_with ( "64" ) {
2114- cmd. args . push ( ( "-march=rv64gc" ) . into ( ) ) ;
2115- cmd. args . push ( "-mabi=lp64d" . into ( ) ) ;
2116- } else if target. contains ( "openbsd" ) && arch. starts_with ( "64" ) {
2117- cmd. args . push ( ( "-march=rv64gc" ) . into ( ) ) ;
2118- cmd. args . push ( "-mabi=lp64d" . into ( ) ) ;
2119- } else if target. contains ( "linux" ) && arch. starts_with ( "32" ) {
2120- cmd. args . push ( ( "-march=rv32gc" ) . into ( ) ) ;
2121- cmd. args . push ( "-mabi=ilp32d" . into ( ) ) ;
2122- } else if arch. starts_with ( "64" ) {
2123- cmd. args . push ( ( "-march=rv" . to_owned ( ) + arch) . into ( ) ) ;
2124- cmd. args . push ( "-mabi=lp64" . into ( ) ) ;
2107+ if arch. starts_with ( "64" ) {
2108+ if target. contains ( "linux" )
2109+ | target. contains ( "freebsd" )
2110+ | target. contains ( "netbsd" )
2111+ | target. contains ( "linux" )
2112+ {
2113+ cmd. args . push ( ( "-march=rv64gc" ) . into ( ) ) ;
2114+ cmd. args . push ( "-mabi=lp64d" . into ( ) ) ;
2115+ } else {
2116+ cmd. args . push ( ( "-march=rv" . to_owned ( ) + arch) . into ( ) ) ;
2117+ cmd. args . push ( "-mabi=lp64" . into ( ) ) ;
2118+ }
2119+ } else if arch. starts_with ( "32" ) {
2120+ if target. contains ( "linux" ) {
2121+ cmd. args . push ( ( "-march=rv32gc" ) . into ( ) ) ;
2122+ cmd. args . push ( "-mabi=ilp32d" . into ( ) ) ;
2123+ } else {
2124+ cmd. args . push ( ( "-march=rv" . to_owned ( ) + arch) . into ( ) ) ;
2125+ cmd. args . push ( "-mabi=ilp32" . into ( ) ) ;
2126+ }
21252127 } else {
2126- cmd. args . push ( ( "-march=rv" . to_owned ( ) + arch) . into ( ) ) ;
2127- cmd. args . push ( "-mabi=ilp32" . into ( ) ) ;
2128+ cmd. args . push ( "-mcmodel=medany" . into ( ) ) ;
21282129 }
2129- cmd. args . push ( "-mcmodel=medany" . into ( ) ) ;
21302130 }
21312131 }
21322132 }
@@ -2588,11 +2588,10 @@ impl Build {
25882588 let cc = if target. contains ( "llvm" ) { clang } else { gnu } ;
25892589 format ! ( "{}.exe" , cc)
25902590 }
2591- } else if target. contains ( "apple-ios" ) {
2592- clang. to_string ( )
2593- } else if target. contains ( "apple-watchos" ) {
2594- clang. to_string ( )
2595- } else if target. contains ( "apple-tvos" ) {
2591+ } else if target. contains ( "apple-ios" )
2592+ | target. contains ( "apple-watchos" )
2593+ | target. contains ( "apple-tvos" )
2594+ {
25962595 clang. to_string ( )
25972596 } else if target. contains ( "android" ) {
25982597 autodetect_android_compiler ( target, & host, gnu, clang)
@@ -2817,13 +2816,11 @@ impl Build {
28172816 let target = self . get_target ( ) ?;
28182817 if target. contains ( "msvc" ) {
28192818 Ok ( None )
2820- } else if target. contains ( "apple" ) {
2821- Ok ( Some ( "c++" . to_string ( ) ) )
2822- } else if target. contains ( "freebsd" ) {
2823- Ok ( Some ( "c++" . to_string ( ) ) )
2824- } else if target. contains ( "openbsd" ) {
2825- Ok ( Some ( "c++" . to_string ( ) ) )
2826- } else if target. contains ( "aix" ) {
2819+ } else if target. contains ( "apple" )
2820+ | target. contains ( "freebsd" )
2821+ | target. contains ( "openbsd" )
2822+ | target. contains ( "aix" )
2823+ {
28272824 Ok ( Some ( "c++" . to_string ( ) ) )
28282825 } else if target. contains ( "android" ) {
28292826 Ok ( Some ( "c++_shared" . to_string ( ) ) )
0 commit comments