@@ -1902,7 +1902,13 @@ impl Build {
1902
1902
1903
1903
// Target flags
1904
1904
match cmd. family {
1905
- ToolFamily :: Clang { .. } => {
1905
+ ToolFamily :: Clang { zig_cc } => {
1906
+ let target = if zig_cc {
1907
+ Cow :: Owned ( target. replace ( "-unknown-" , "-" ) )
1908
+ } else {
1909
+ Cow :: Borrowed ( target)
1910
+ } ;
1911
+
1906
1912
if !cmd. has_internal_target_arg
1907
1913
&& !( target. contains ( "android" )
1908
1914
&& android_clang_compiler_uses_target_arg_internally ( & cmd. path ) )
@@ -1916,21 +1922,21 @@ impl Build {
1916
1922
1917
1923
if target. contains ( "darwin" ) {
1918
1924
if let Some ( arch) =
1919
- map_darwin_target_from_rust_to_compiler_architecture ( target)
1925
+ map_darwin_target_from_rust_to_compiler_architecture ( target. as_ref ( ) )
1920
1926
{
1921
1927
cmd. args
1922
1928
. push ( format ! ( "--target={}-apple-darwin" , arch) . into ( ) ) ;
1923
1929
}
1924
1930
} else if target. contains ( "macabi" ) {
1925
1931
if let Some ( arch) =
1926
- map_darwin_target_from_rust_to_compiler_architecture ( target)
1932
+ map_darwin_target_from_rust_to_compiler_architecture ( target. as_ref ( ) )
1927
1933
{
1928
1934
cmd. args
1929
1935
. push ( format ! ( "--target={}-apple-ios-macabi" , arch) . into ( ) ) ;
1930
1936
}
1931
1937
} else if target. contains ( "ios-sim" ) {
1932
1938
if let Some ( arch) =
1933
- map_darwin_target_from_rust_to_compiler_architecture ( target)
1939
+ map_darwin_target_from_rust_to_compiler_architecture ( target. as_ref ( ) )
1934
1940
{
1935
1941
let sdk_details =
1936
1942
apple_os_sdk_parts ( AppleOs :: Ios , & AppleArchSpec :: Simulator ( "" ) ) ;
@@ -1946,7 +1952,7 @@ impl Build {
1946
1952
}
1947
1953
} else if target. contains ( "watchos-sim" ) {
1948
1954
if let Some ( arch) =
1949
- map_darwin_target_from_rust_to_compiler_architecture ( target)
1955
+ map_darwin_target_from_rust_to_compiler_architecture ( target. as_ref ( ) )
1950
1956
{
1951
1957
let sdk_details =
1952
1958
apple_os_sdk_parts ( AppleOs :: WatchOs , & AppleArchSpec :: Simulator ( "" ) ) ;
@@ -1965,7 +1971,7 @@ impl Build {
1965
1971
}
1966
1972
} else if target. contains ( "tvos-sim" ) || target. contains ( "x86_64-apple-tvos" ) {
1967
1973
if let Some ( arch) =
1968
- map_darwin_target_from_rust_to_compiler_architecture ( target)
1974
+ map_darwin_target_from_rust_to_compiler_architecture ( target. as_ref ( ) )
1969
1975
{
1970
1976
let sdk_details =
1971
1977
apple_os_sdk_parts ( AppleOs :: TvOs , & AppleArchSpec :: Simulator ( "" ) ) ;
@@ -1984,7 +1990,7 @@ impl Build {
1984
1990
}
1985
1991
} else if target. contains ( "aarch64-apple-tvos" ) {
1986
1992
if let Some ( arch) =
1987
- map_darwin_target_from_rust_to_compiler_architecture ( target)
1993
+ map_darwin_target_from_rust_to_compiler_architecture ( target. as_ref ( ) )
1988
1994
{
1989
1995
let sdk_details =
1990
1996
apple_os_sdk_parts ( AppleOs :: TvOs , & AppleArchSpec :: Device ( "" ) ) ;
@@ -1998,7 +2004,7 @@ impl Build {
1998
2004
) ;
1999
2005
}
2000
2006
} else if let Ok ( index) = target_info:: RISCV_ARCH_MAPPING
2001
- . binary_search_by_key ( & arch, |( arch, _) | & arch)
2007
+ . binary_search_by_key ( & arch, |( arch, _) | arch)
2002
2008
{
2003
2009
cmd. args . push (
2004
2010
format ! (
0 commit comments