@@ -1978,8 +1978,8 @@ impl Build {
1978
1978
// Disambiguate mingw and msvc on Windows. Problem is that
1979
1979
// depending on the origin clang can default to a mismatchig
1980
1980
// run-time.
1981
- // FIXME: Convert rustc target to Clang target.
1982
- cmd. push_cc_arg ( format ! ( "--target={raw_target }" ) . into ( ) ) ;
1981
+ let llvm_target = target. versioned_llvm_target ( None ) ;
1982
+ cmd. push_cc_arg ( format ! ( "--target={llvm_target }" ) . into ( ) ) ;
1983
1983
}
1984
1984
1985
1985
if cmd. is_like_clang ( ) && target. os == "android" {
@@ -2065,77 +2065,7 @@ impl Build {
2065
2065
|| ( target. os == "android"
2066
2066
&& android_clang_compiler_uses_target_arg_internally ( & cmd. path ) ) )
2067
2067
{
2068
- if target. os == "macos" {
2069
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2070
- cmd. args
2071
- . push ( format ! ( "--target={}-apple-darwin" , arch) . into ( ) ) ;
2072
- } else if target. abi == "macabi" {
2073
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2074
- cmd. args
2075
- . push ( format ! ( "--target={}-apple-ios-macabi" , arch) . into ( ) ) ;
2076
- } else if target. os == "ios" && target. abi == "sim" {
2077
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2078
- let deployment_target = self . apple_deployment_target ( target) ;
2079
- cmd. args . push (
2080
- format ! ( "--target={}-apple-ios{}-simulator" , arch, deployment_target)
2081
- . into ( ) ,
2082
- ) ;
2083
- } else if target. os == "watchos" && target. abi == "sim" {
2084
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2085
- let deployment_target = self . apple_deployment_target ( target) ;
2086
- cmd. args . push (
2087
- format ! (
2088
- "--target={}-apple-watchos{}-simulator" ,
2089
- arch, deployment_target
2090
- )
2091
- . into ( ) ,
2092
- ) ;
2093
- } else if target. os == "tvos" && target. abi == "sim" {
2094
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2095
- let deployment_target = self . apple_deployment_target ( target) ;
2096
- cmd. args . push (
2097
- format ! (
2098
- "--target={}-apple-tvos{}-simulator" ,
2099
- arch, deployment_target
2100
- )
2101
- . into ( ) ,
2102
- ) ;
2103
- } else if target. os == "tvos" {
2104
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2105
- let deployment_target = self . apple_deployment_target ( target) ;
2106
- cmd. args . push (
2107
- format ! ( "--target={}-apple-tvos{}" , arch, deployment_target) . into ( ) ,
2108
- ) ;
2109
- } else if target. os == "visionos" && target. abi == "sim" {
2110
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2111
- let deployment_target = self . apple_deployment_target ( target) ;
2112
- cmd. args . push (
2113
- format ! (
2114
- "--target={}-apple-xros{}-simulator" ,
2115
- arch, deployment_target
2116
- )
2117
- . into ( ) ,
2118
- ) ;
2119
- } else if target. os == "visionos" {
2120
- let arch = map_darwin_target_from_rust_to_compiler_architecture ( target) ;
2121
- let deployment_target = self . apple_deployment_target ( target) ;
2122
- cmd. args . push (
2123
- format ! ( "--target={}-apple-xros{}" , arch, deployment_target) . into ( ) ,
2124
- ) ;
2125
- } else if target. arch == "riscv32" || target. arch == "riscv64" {
2126
- // FIXME: Convert rustc target to Clang target
2127
- let ( _, rest) = raw_target. split_once ( '-' ) . unwrap ( ) ;
2128
- cmd. args
2129
- . push ( format ! ( "--target={}-{}" , & target. arch, rest) . into ( ) ) ;
2130
- } else if target. os == "uefi" {
2131
- if target. arch == "x86_64" {
2132
- cmd. args . push ( "--target=x86_64-unknown-windows-gnu" . into ( ) ) ;
2133
- } else if target. arch == "x86" {
2134
- cmd. args . push ( "--target=i686-unknown-windows-gnu" . into ( ) )
2135
- } else if target. arch == "aarch64" {
2136
- cmd. args . push ( "--target=aarch64-unknown-windows-gnu" . into ( ) )
2137
- }
2138
- } else if target. os == "freebsd" {
2068
+ if target. os == "freebsd" {
2139
2069
// FreeBSD only supports C++11 and above when compiling against libc++
2140
2070
// (available from FreeBSD 10 onwards). Under FreeBSD, clang uses libc++ by
2141
2071
// default on FreeBSD 10 and newer unless `--target` is manually passed to
@@ -2157,18 +2087,17 @@ impl Build {
2157
2087
if self . cpp && self . cpp_set_stdlib . is_none ( ) {
2158
2088
cmd. push_cc_arg ( "-stdlib=libc++" . into ( ) ) ;
2159
2089
}
2090
+ }
2160
2091
2161
- // FIXME: Convert rustc target to Clang target.
2162
- cmd. push_cc_arg ( format ! ( "--target={}" , raw_target) . into ( ) ) ;
2163
- } else if target. os == "windows" {
2164
- cmd. args . push (
2165
- format ! ( "--target={}-pc-windows-{}" , target. full_arch, target. env)
2166
- . into ( ) ,
2167
- )
2092
+ // Add version information to the target.
2093
+ let llvm_target = if target. vendor == "apple" {
2094
+ let deployment_target = self . apple_deployment_target ( & target) ;
2095
+ target. versioned_llvm_target ( Some ( & deployment_target) )
2168
2096
} else {
2169
- // FIXME: Convert rustc target to Clang target.
2170
- cmd. push_cc_arg ( format ! ( "--target={}" , raw_target) . into ( ) ) ;
2171
- }
2097
+ target. versioned_llvm_target ( None )
2098
+ } ;
2099
+
2100
+ cmd. args . push ( format ! ( "--target={llvm_target}" ) . into ( ) ) ;
2172
2101
}
2173
2102
}
2174
2103
ToolFamily :: Msvc { clang_cl } => {
@@ -2184,8 +2113,8 @@ impl Build {
2184
2113
cmd. push_cc_arg ( "-m32" . into ( ) ) ;
2185
2114
cmd. push_cc_arg ( "-arch:IA32" . into ( ) ) ;
2186
2115
} else {
2187
- // FIXME: Convert rustc target to Clang target.
2188
- cmd. push_cc_arg ( format ! ( "--target={}" , raw_target ) . into ( ) ) ;
2116
+ let llvm_target = target. versioned_llvm_target ( None ) ;
2117
+ cmd. push_cc_arg ( format ! ( "--target={llvm_target}" ) . into ( ) ) ;
2189
2118
}
2190
2119
} else if target. full_arch == "i586" {
2191
2120
cmd. push_cc_arg ( "-arch:IA32" . into ( ) ) ;
0 commit comments