diff --git a/src/mono/mono/utils/mono-codeman.c b/src/mono/mono/utils/mono-codeman.c index 26f8715c61dd0b..c655d04c8ccbea 100644 --- a/src/mono/mono/utils/mono-codeman.c +++ b/src/mono/mono/utils/mono-codeman.c @@ -735,12 +735,10 @@ mono_codeman_enable_write (void) if (codeman_no_exec) return; #ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP - if (__builtin_available (macOS 11, *)) { - int level = GPOINTER_TO_INT (mono_native_tls_get_value (write_level_tls_id)); - level ++; - mono_native_tls_set_value (write_level_tls_id, GINT_TO_POINTER (level)); - pthread_jit_write_protect_np (0); - } + int level = GPOINTER_TO_INT (mono_native_tls_get_value (write_level_tls_id)); + level ++; + mono_native_tls_set_value (write_level_tls_id, GINT_TO_POINTER (level)); + pthread_jit_write_protect_np (0); #elif defined(HOST_MACCAT) && defined(__aarch64__) /* JITing in Catalyst apps is not allowed on Apple Silicon, so assume if we're here we don't really have executable pages. */ #endif @@ -758,14 +756,12 @@ mono_codeman_disable_write (void) if (codeman_no_exec) return; #ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP - if (__builtin_available (macOS 11, *)) { - int level = GPOINTER_TO_INT (mono_native_tls_get_value (write_level_tls_id)); - g_assert (level); - level --; - mono_native_tls_set_value (write_level_tls_id, GINT_TO_POINTER (level)); - if (level == 0) - pthread_jit_write_protect_np (1); - } + int level = GPOINTER_TO_INT (mono_native_tls_get_value (write_level_tls_id)); + g_assert (level); + level --; + mono_native_tls_set_value (write_level_tls_id, GINT_TO_POINTER (level)); + if (level == 0) + pthread_jit_write_protect_np (1); #elif defined(HOST_MACCAT) && defined(__aarch64__) /* JITing in Catalyst apps is not allowed on Apple Silicon, so assume if we're here we don't really have executable pages */ #endif diff --git a/src/mono/mono/utils/mono-mmap.c b/src/mono/mono/utils/mono-mmap.c index 09af6f8994b942..fe7db3bbaf3b8a 100644 --- a/src/mono/mono/utils/mono-mmap.c +++ b/src/mono/mono/utils/mono-mmap.c @@ -285,9 +285,7 @@ mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type) mflags |= MAP_JIT; #if defined(HOST_ARM64) && !defined(HOST_MACCAT) /* Patching code on apple silicon seems to cause random crashes without this flag */ - /* No __builtin_available in old versions of Xcode that could be building Mono on x86 or amd64 */ - if (__builtin_available (macOS 11, *)) - mflags |= MAP_JIT; + mflags |= MAP_JIT; #endif } #endif diff --git a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_ecc.c b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_ecc.c index dc5f195ab24226..88c4832ef30736 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_ecc.c +++ b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_ecc.c @@ -24,10 +24,7 @@ int32_t AppleCryptoNative_EccGenerateKey(int32_t keySizeBits, { CFDictionaryAddValue(attributes, kSecAttrKeyType, kSecAttrKeyTypeEC); CFDictionaryAddValue(attributes, kSecAttrKeySizeInBits, cfKeySizeValue); - if (__builtin_available(macOS 10.15, iOS 13, tvOS 13, *)) - { - CFDictionaryAddValue(attributes, kSecUseDataProtectionKeychain, kCFBooleanTrue); - } + CFDictionaryAddValue(attributes, kSecUseDataProtectionKeychain, kCFBooleanTrue); *pPrivateKey = SecKeyCreateRandomKey(attributes, pErrorOut); if (*pPrivateKey != NULL) diff --git a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_rsa.c b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_rsa.c index 1746828d5b0d7d..fa76a4323225e5 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_rsa.c +++ b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_rsa.c @@ -26,10 +26,7 @@ int32_t AppleCryptoNative_RsaGenerateKey(int32_t keySizeBits, { CFDictionaryAddValue(attributes, kSecAttrKeyType, kSecAttrKeyTypeRSA); CFDictionaryAddValue(attributes, kSecAttrKeySizeInBits, cfKeySizeValue); - if (__builtin_available(macOS 10.15, iOS 13, tvOS 13, *)) - { - CFDictionaryAddValue(attributes, kSecUseDataProtectionKeychain, kCFBooleanTrue); - } + CFDictionaryAddValue(attributes, kSecUseDataProtectionKeychain, kCFBooleanTrue); *pPrivateKey = SecKeyCreateRandomKey(attributes, pErrorOut); if (*pPrivateKey != NULL) diff --git a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_sec.c b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_sec.c index 07cc20d1724f20..8e48ff2ea279a5 100644 --- a/src/native/libs/System.Security.Cryptography.Native.Apple/pal_sec.c +++ b/src/native/libs/System.Security.Cryptography.Native.Apple/pal_sec.c @@ -5,10 +5,5 @@ CFStringRef AppleCryptoNative_SecCopyErrorMessageString(OSStatus osStatus) { - if (__builtin_available(iOS 11.3, tvOS 11.3, *)) - { - return SecCopyErrorMessageString(osStatus, NULL); - } - - return CFStringCreateWithFormat(NULL, NULL, CFSTR("OSStatus %d"), (int)osStatus); + return SecCopyErrorMessageString(osStatus, NULL); } diff --git a/src/native/minipal/memorybarrierprocesswide.c b/src/native/minipal/memorybarrierprocesswide.c index 7582332f86c9e9..6a9704c9920a98 100644 --- a/src/native/minipal/memorybarrierprocesswide.c +++ b/src/native/minipal/memorybarrierprocesswide.c @@ -166,27 +166,9 @@ void minipal_memory_barrier_process_wide(void) // Iterate through each of the threads in the list. for (mach_msg_type_number_t i = 0; i < cThreads; i++) { - if (__builtin_available (macOS 10.14, iOS 12, tvOS 9, *)) - { - // Request the threads pointer values to force the thread to emit a memory barrier - size_t registers = 128; - machret = thread_get_register_pointer_values(pThreads[i], &sp, ®isters, registerValues); - } - else - { - // fallback implementation for older OS versions -#if defined(HOST_AMD64) - x86_thread_state64_t threadState; - mach_msg_type_number_t count = x86_THREAD_STATE64_COUNT; - machret = thread_get_state(pThreads[i], x86_THREAD_STATE64, (thread_state_t)&threadState, &count); -#elif defined(HOST_ARM64) - arm_thread_state64_t threadState; - mach_msg_type_number_t count = ARM_THREAD_STATE64_COUNT; - machret = thread_get_state(pThreads[i], ARM_THREAD_STATE64, (thread_state_t)&threadState, &count); -#else - #error Unexpected architecture -#endif - } + // Request the threads pointer values to force the thread to emit a memory barrier + size_t registers = 128; + machret = thread_get_register_pointer_values(pThreads[i], &sp, ®isters, registerValues); if (machret == KERN_INSUFFICIENT_BUFFER_SIZE) {