@@ -13,8 +13,10 @@ pub fn opts(os: &str) -> TargetOptions {
13
13
// warnings about the usage of ELF TLS.
14
14
//
15
15
// Here we detect what version is being requested, defaulting to 10.7. ELF
16
- // TLS is flagged as enabled if it looks to be supported.
17
- let version = macos_deployment_target ( ) ;
16
+ // TLS is flagged as enabled if it looks to be supported. The architecture
17
+ // only matters for default deployment target which is 11.0 for ARM64 and
18
+ // 10.7 for everything else.
19
+ let has_elf_tls = macos_deployment_target ( "x86_64" ) >= ( 10 , 7 ) ;
18
20
19
21
TargetOptions {
20
22
os : os. to_string ( ) ,
@@ -31,7 +33,7 @@ pub fn opts(os: &str) -> TargetOptions {
31
33
has_rpath : true ,
32
34
dll_suffix : ".dylib" . to_string ( ) ,
33
35
archive_format : "darwin" . to_string ( ) ,
34
- has_elf_tls : version >= ( 10 , 7 ) ,
36
+ has_elf_tls,
35
37
abi_return_struct_as_int : true ,
36
38
emit_debug_gdb_scripts : false ,
37
39
eh_frame_header : false ,
@@ -63,12 +65,17 @@ fn deployment_target(var_name: &str) -> Option<(u32, u32)> {
63
65
. and_then ( |( a, b) | a. parse :: < u32 > ( ) . and_then ( |a| b. parse :: < u32 > ( ) . map ( |b| ( a, b) ) ) . ok ( ) )
64
66
}
65
67
66
- fn macos_deployment_target ( ) -> ( u32 , u32 ) {
67
- deployment_target ( "MACOSX_DEPLOYMENT_TARGET" ) . unwrap_or ( ( 10 , 7 ) )
68
+ fn macos_default_deployment_target ( arch : & str ) -> ( u32 , u32 ) {
69
+ if arch == "arm64" { ( 11 , 0 ) } else { ( 10 , 7 ) }
70
+ }
71
+
72
+ fn macos_deployment_target ( arch : & str ) -> ( u32 , u32 ) {
73
+ deployment_target ( "MACOSX_DEPLOYMENT_TARGET" )
74
+ . unwrap_or_else ( || macos_default_deployment_target ( arch) )
68
75
}
69
76
70
77
pub fn macos_llvm_target ( arch : & str ) -> String {
71
- let ( major, minor) = macos_deployment_target ( ) ;
78
+ let ( major, minor) = macos_deployment_target ( arch ) ;
72
79
format ! ( "{}-apple-macosx{}.{}.0" , arch, major, minor)
73
80
}
74
81
0 commit comments