diff --git a/Directory.Build.props b/Directory.Build.props
index 32024db00c9006..258bcd499d40a4 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -47,16 +47,22 @@
-
+
+ 21
11.0
11.0
2.0
5.1
10.15
11.0
-
-
- 21
diff --git a/eng/Subsets.props b/eng/Subsets.props
index 57a46f8064c03c..190a2cffa7ebe9 100644
--- a/eng/Subsets.props
+++ b/eng/Subsets.props
@@ -45,7 +45,8 @@
- Mono
+ Mono
+ CoreCLR
Mono
$(PrimaryRuntimeFlavor)
@@ -105,7 +106,7 @@
- true
+ true
true
diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh
index c56592494332bd..f571bccdcecfd5 100755
--- a/eng/native/build-commons.sh
+++ b/eng/native/build-commons.sh
@@ -102,6 +102,58 @@ build_native()
echo "Error: Unknown Android architecture $hostArch."
exit 1
fi
+ elif [[ "$__TargetOS" == iossimulator ]]; then
+ cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs"
+
+ # set default iOS simulator deployment target
+ # keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
+ cmakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $cmakeArgs"
+ if [[ "$__TargetArch" == x64 ]]; then
+ cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $cmakeArgs"
+ elif [[ "$__TargetArch" == arm64 ]]; then
+ cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $cmakeArgs"
+ else
+ echo "Error: Unknown iOS Simulator architecture $__TargetArch."
+ exit 1
+ fi
+ elif [[ "$__TargetOS" == ios ]]; then
+ cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs"
+
+ # set default iOS device deployment target
+ # keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
+ cmakeArgs="-DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $cmakeArgs"
+ if [[ "$__TargetArch" == arm64 ]]; then
+ cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $cmakeArgs"
+ else
+ echo "Error: Unknown iOS architecture $__TargetArch."
+ exit 1
+ fi
+ elif [[ "$__TargetOS" == tvossimulator ]]; then
+ cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs"
+
+ # set default tvOS simulator deployment target
+ # keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
+ cmakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $cmakeArgs"
+ if [[ "$__TargetArch" == x64 ]]; then
+ cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"x86_64\" $cmakeArgs"
+ elif [[ "$__TargetArch" == arm64 ]]; then
+ cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $cmakeArgs"
+ else
+ echo "Error: Unknown tvOS Simulator architecture $__TargetArch."
+ exit 1
+ fi
+ elif [[ "$__TargetOS" == tvos ]]; then
+ cmakeArgs="-C $__RepoRootDir/eng/native/tryrun_ios_tvos.cmake $cmakeArgs"
+
+ # set default tvOS device deployment target
+ # keep in sync with SetOSTargetMinVersions in the root Directory.Build.props
+ cmakeArgs="-DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 $cmakeArgs"
+ if [[ "$__TargetArch" == arm64 ]]; then
+ cmakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $cmakeArgs"
+ else
+ echo "Error: Unknown tvOS architecture $__TargetArch."
+ exit 1
+ fi
fi
if [[ "$__UseNinja" == 1 ]]; then
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index 3c667e13a13425..0930fc03e274fa 100644
--- a/eng/native/configurecompiler.cmake
+++ b/eng/native/configurecompiler.cmake
@@ -200,7 +200,7 @@ elseif(CLR_CMAKE_HOST_SUNOS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector")
add_definitions(-D__EXTENSIONS__ -D_XPG4_2 -D_POSIX_PTHREAD_SEMANTICS)
-elseif(CLR_CMAKE_HOST_OSX AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
+elseif(CLR_CMAKE_HOST_OSX AND NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
add_definitions(-D_XOPEN_SOURCE)
add_linker_flag("-Wl,-bind_at_load")
endif()
@@ -276,7 +276,12 @@ if (CLR_CMAKE_HOST_UNIX)
add_definitions(-DHOST_UNIX)
if(CLR_CMAKE_HOST_OSX OR CLR_CMAKE_HOST_MACCATALYST)
- add_definitions(-DHOST_OSX)
+ add_definitions(-DHOST_APPLE)
+ if(CLR_CMAKE_HOST_MACCATALYST)
+ add_definitions(-DHOST_MACCATALYST)
+ else()
+ add_definitions(-DHOST_OSX)
+ endif()
if(CLR_CMAKE_HOST_UNIX_AMD64)
message("Detected OSX x86_64")
elseif(CLR_CMAKE_HOST_UNIX_ARM64)
@@ -284,6 +289,26 @@ if (CLR_CMAKE_HOST_UNIX)
else()
clr_unknown_arch()
endif()
+ elseif (CLR_CMAKE_HOST_IOS)
+ add_definitions(-DHOST_APPLE)
+ add_definitions(-DHOST_IOS)
+ if(CLR_CMAKE_HOST_UNIX_AMD64)
+ message("Detected iOS x86_64")
+ elseif(CLR_CMAKE_HOST_UNIX_ARM64)
+ message("Detected iOS ARM64")
+ else()
+ clr_unknown_arch()
+ endif()
+ elseif (CLR_CMAKE_HOST_TVOS)
+ add_definitions(-DHOST_APPLE)
+ add_definitions(-DHOST_TVOS)
+ if(CLR_CMAKE_HOST_UNIX_AMD64)
+ message("Detected tvOS x86_64")
+ elseif(CLR_CMAKE_HOST_UNIX_ARM64)
+ message("Detected tvOS ARM64")
+ else()
+ clr_unknown_arch()
+ endif()
elseif(CLR_CMAKE_HOST_FREEBSD)
if(CLR_CMAKE_HOST_UNIX_ARM64)
message("Detected FreeBSD aarch64")
@@ -542,8 +567,17 @@ if(CLR_CMAKE_TARGET_UNIX)
add_compile_definitions($<$>>:TARGET_UNIX>)
# Contracts are disabled on UNIX.
add_definitions(-DDISABLE_CONTRACTS)
- if(CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
+ if(CLR_CMAKE_TARGET_APPLE)
+ add_compile_definitions($<$>>:TARGET_APPLE>)
+ endif()
+ if(CLR_CMAKE_TARGET_OSX)
add_compile_definitions($<$>>:TARGET_OSX>)
+ elseif(CLR_CMAKE_TARGET_MACCATALYST)
+ add_compile_definitions($<$>>:TARGET_MACCATALYST>)
+ elseif(CLR_CMAKE_TARGET_IOS)
+ add_compile_definitions($<$>>:TARGET_IOS>)
+ elseif(CLR_CMAKE_TARGET_TVOS)
+ add_compile_definitions($<$>>:TARGET_TVOS>)
elseif(CLR_CMAKE_TARGET_FREEBSD)
add_compile_definitions($<$>>:TARGET_FREEBSD>)
elseif(CLR_CMAKE_TARGET_ANDROID)
diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index 9907cd09e80e11..192e3a302974ac 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -99,6 +99,7 @@ endif(CLR_CMAKE_HOST_OS STREQUAL linux)
if(CLR_CMAKE_HOST_OS STREQUAL darwin)
set(CLR_CMAKE_HOST_UNIX 1)
+ set(CLR_CMAKE_HOST_APPLE 1)
if(CMAKE_SYSTEM_VARIANT STREQUAL maccatalyst)
set(CLR_CMAKE_HOST_MACCATALYST 1)
@@ -118,6 +119,7 @@ endif(CLR_CMAKE_HOST_OS STREQUAL darwin)
if(CLR_CMAKE_HOST_OS STREQUAL ios OR CLR_CMAKE_HOST_OS STREQUAL iossimulator)
set(CLR_CMAKE_HOST_UNIX 1)
+ set(CLR_CMAKE_HOST_APPLE 1)
set(CLR_CMAKE_HOST_IOS 1)
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
@@ -134,6 +136,7 @@ endif(CLR_CMAKE_HOST_OS STREQUAL ios OR CLR_CMAKE_HOST_OS STREQUAL iossimulator)
if(CLR_CMAKE_HOST_OS STREQUAL tvos OR CLR_CMAKE_HOST_OS STREQUAL tvossimulator)
set(CLR_CMAKE_HOST_UNIX 1)
+ set(CLR_CMAKE_HOST_APPLE 1)
set(CLR_CMAKE_HOST_TVOS 1)
if(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
@@ -374,6 +377,7 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL android)
if(CLR_CMAKE_TARGET_OS STREQUAL darwin)
set(CLR_CMAKE_TARGET_UNIX 1)
+ set(CLR_CMAKE_TARGET_APPLE 1)
if(CMAKE_SYSTEM_VARIANT STREQUAL maccatalyst)
set(CLR_CMAKE_TARGET_MACCATALYST 1)
@@ -384,11 +388,13 @@ endif(CLR_CMAKE_TARGET_OS STREQUAL darwin)
if(CLR_CMAKE_TARGET_OS STREQUAL ios OR CLR_CMAKE_TARGET_OS STREQUAL iossimulator)
set(CLR_CMAKE_TARGET_UNIX 1)
+ set(CLR_CMAKE_TARGET_APPLE 1)
set(CLR_CMAKE_TARGET_IOS 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL ios OR CLR_CMAKE_TARGET_OS STREQUAL iossimulator)
if(CLR_CMAKE_TARGET_OS STREQUAL tvos OR CLR_CMAKE_TARGET_OS STREQUAL tvossimulator)
set(CLR_CMAKE_TARGET_UNIX 1)
+ set(CLR_CMAKE_TARGET_APPLE 1)
set(CLR_CMAKE_TARGET_TVOS 1)
endif(CLR_CMAKE_TARGET_OS STREQUAL tvos OR CLR_CMAKE_TARGET_OS STREQUAL tvossimulator)
@@ -474,7 +480,7 @@ endif()
if(NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
# The default linker on Solaris also does not support PIE.
- if(NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_SUNOS AND NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_HOST_TVOS AND NOT CLR_CMAKE_HOST_IOS AND NOT MSVC)
+ if(NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_SUNOS AND NOT CLR_CMAKE_TARGET_APPLE AND NOT MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
add_compile_options($<$,EXECUTABLE>:-fPIE>)
add_compile_options($<$,SHARED_LIBRARY>:-fPIC>)
diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake
index 1f800b0f897895..7624b31ac46c4f 100644
--- a/eng/native/configuretools.cmake
+++ b/eng/native/configuretools.cmake
@@ -51,7 +51,7 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI)
locate_toolchain_exec(link CMAKE_LINKER YES)
endif()
- if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
+ if(NOT CLR_CMAKE_TARGET_APPLE AND (NOT CLR_CMAKE_TARGET_ANDROID OR CROSS_ROOTFS))
locate_toolchain_exec(objdump CMAKE_OBJDUMP YES)
unset(CMAKE_OBJCOPY CACHE)
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index 8e03f566cf7c1d..3ca46788716045 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -327,7 +327,7 @@ function(generate_exports_file)
list(GET INPUT_LIST -1 outputFilename)
list(REMOVE_AT INPUT_LIST -1)
- if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ if(CLR_CMAKE_TARGET_APPLE)
set(SCRIPT_NAME generateexportedsymbols.sh)
else()
set(SCRIPT_NAME generateversionscript.sh)
@@ -366,7 +366,7 @@ endfunction()
function (get_symbol_file_name targetName outputSymbolFilename)
if (CLR_CMAKE_HOST_UNIX)
- if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ if (CLR_CMAKE_TARGET_APPLE)
set(strip_destination_file $.dwarf)
else ()
set(strip_destination_file $.dbg)
@@ -386,7 +386,7 @@ function(strip_symbols targetName outputFilename)
if (CLR_CMAKE_HOST_UNIX)
set(strip_source_file $)
- if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ if (CLR_CMAKE_TARGET_APPLE)
# Ensure that dsymutil and strip are present
find_program(DSYMUTIL dsymutil)
@@ -425,7 +425,7 @@ function(strip_symbols targetName outputFilename)
COMMAND ${strip_command}
COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}"
)
- else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ else (CLR_CMAKE_TARGET_APPLE)
add_custom_command(
TARGET ${targetName}
@@ -436,7 +436,7 @@ function(strip_symbols targetName outputFilename)
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=${strip_destination_file} ${strip_source_file}
COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}"
)
- endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ endif (CLR_CMAKE_TARGET_APPLE)
endif(CLR_CMAKE_HOST_UNIX)
endfunction()
@@ -446,7 +446,7 @@ function(install_with_stripped_symbols targetName kind destination)
install_symbol_file(${symbol_file} ${destination} ${ARGN})
endif()
- if ((CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) AND ("${kind}" STREQUAL "TARGETS"))
+ if (CLR_CMAKE_TARGET_APPLE AND ("${kind}" STREQUAL "TARGETS"))
# We want to avoid the kind=TARGET install behaviors which corrupt code signatures on osx-arm64
set(kind PROGRAMS)
endif()
diff --git a/eng/native/tryrun_ios_tvos.cmake b/eng/native/tryrun_ios_tvos.cmake
new file mode 100644
index 00000000000000..46769ca69daa3b
--- /dev/null
+++ b/eng/native/tryrun_ios_tvos.cmake
@@ -0,0 +1,50 @@
+macro(set_cache_value)
+ set(${ARGV0} ${ARGV1} CACHE STRING "Result from TRY_RUN" FORCE)
+ set(${ARGV0}__TRYRUN_OUTPUT "dummy output" CACHE STRING "Output from TRY_RUN" FORCE)
+endmacro()
+
+set_cache_value(HAVE_SCHED_GETCPU_EXITCODE 1)
+set_cache_value(HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE 1)
+set_cache_value(HAVE_CLOCK_MONOTONIC_EXITCODE 0)
+
+
+# TODO: these are taken from macOS, check these whether they're correct for iOS
+# some of them are probably not used by what we use from NativeAOT so could be reduced
+set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1)
+set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 1)
+set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 1)
+set_cache_value(HAVE_BROKEN_FIFO_KEVENT_EXITCODE 1)
+set_cache_value(HAVE_BROKEN_FIFO_SELECT_EXITCODE 1)
+set_cache_value(HAVE_CLOCK_REALTIME_EXITCODE 0)
+set_cache_value(HAVE_CLOCK_THREAD_CPUTIME_EXITCODE 0)
+set_cache_value(HAVE_CLOCK_GETTIME_NSEC_NP_EXITCODE 0)
+set_cache_value(HAVE_COMPATIBLE_ACOS_EXITCODE 0)
+set_cache_value(HAVE_COMPATIBLE_ASIN_EXITCODE 0)
+set_cache_value(HAVE_COMPATIBLE_ATAN2_EXITCODE 0)
+set_cache_value(HAVE_COMPATIBLE_EXP_EXITCODE 1)
+set_cache_value(HAVE_COMPATIBLE_ILOGB0_EXITCODE 0)
+set_cache_value(HAVE_COMPATIBLE_ILOGBNAN_EXITCODE 1)
+set_cache_value(HAVE_COMPATIBLE_LOG10_EXITCODE 0)
+set_cache_value(HAVE_COMPATIBLE_LOG_EXITCODE 0)
+set_cache_value(HAVE_COMPATIBLE_POW_EXITCODE 0)
+set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 1)
+set_cache_value(HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE 0)
+set_cache_value(HAVE_MMAP_DEV_ZERO_EXITCODE 1)
+set_cache_value(HAVE_PROCFS_CTL_EXITCODE 1)
+set_cache_value(HAVE_PROCFS_MAPS_EXITCODE 1)
+set_cache_value(HAVE_PROCFS_STATUS_EXITCODE 1)
+set_cache_value(HAVE_PROCFS_STAT_EXITCODE 1)
+set_cache_value(HAVE_SCHED_GET_PRIORITY_EXITCODE 0)
+set_cache_value(HAVE_VALID_NEGATIVE_INF_POW_EXITCODE 0)
+set_cache_value(HAVE_VALID_POSITIVE_INF_POW_EXITCODE 0)
+set_cache_value(HAVE_WORKING_CLOCK_GETTIME_EXITCODE 0)
+set_cache_value(HAVE_WORKING_GETTIMEOFDAY_EXITCODE 0)
+set_cache_value(MMAP_ANON_IGNORES_PROTECTION_EXITCODE 1)
+set_cache_value(ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE 1)
+set_cache_value(PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE 1)
+set_cache_value(REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE 1)
+set_cache_value(SEM_INIT_MODIFIES_ERRNO_EXITCODE 1)
+set_cache_value(SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE 1)
+set_cache_value(SSCANF_SUPPORT_ll_EXITCODE 0)
+set_cache_value(UNGETC_NOT_RETURN_EOF_EXITCODE 1)
+set_cache_value(HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP_EXITCODE 1)
diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt
index 9f632a5194ebaa..e7cd64d24922a0 100644
--- a/src/coreclr/CMakeLists.txt
+++ b/src/coreclr/CMakeLists.txt
@@ -40,6 +40,10 @@ if(CORECLR_SET_RPATH)
set(MACOSX_RPATH ON)
endif(CORECLR_SET_RPATH)
+if(CLR_CMAKE_HOST_MACCATALYST OR CLR_CMAKE_HOST_IOS OR CLR_CMAKE_HOST_TVOS)
+ set(FEATURE_EVENT_TRACE 0)
+endif()
+
OPTION(CLR_CMAKE_ENABLE_CODE_COVERAGE "Enable code coverage" OFF)
#----------------------------------------------------
@@ -105,8 +109,10 @@ if(CLR_CMAKE_HOST_UNIX)
endif()
endif()
- add_subdirectory(pal)
- add_subdirectory(hosts)
+ if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
+ add_subdirectory(pal)
+ add_subdirectory(hosts)
+ endif()
else()
if(CLR_CMAKE_TARGET_UNIX)
add_subdirectory(${CLR_SRC_NATIVE_DIR}/external/libunwind_extras ${CLR_ARTIFACTS_OBJ_DIR}/external/libunwind)
@@ -119,7 +125,10 @@ add_subdirectory(pal/prebuilt/inc)
# These need to happen before the VM and debug-pal includes.
set(EP_GENERATED_HEADER_PATH "${GENERATED_INCLUDE_DIR}")
include (${CLR_SRC_NATIVE_DIR}/eventpipe/configure.cmake)
-add_subdirectory(debug/debug-pal)
+
+if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
+ add_subdirectory(debug/debug-pal)
+endif()
add_subdirectory(minipal)
@@ -233,30 +242,32 @@ if(CLR_CMAKE_HOST_UNIX)
add_subdirectory(nativeresources)
endif(CLR_CMAKE_HOST_UNIX)
-add_subdirectory(utilcode)
-add_subdirectory(inc)
-
-if(CLR_CMAKE_HOST_UNIX)
- add_subdirectory(palrt)
-endif(CLR_CMAKE_HOST_UNIX)
-
-add_subdirectory(ilasm)
-add_subdirectory(ildasm)
-add_subdirectory(gcinfo)
-add_subdirectory(jit)
-add_subdirectory(vm)
-add_subdirectory(md)
-add_subdirectory(debug)
-add_subdirectory(binder)
-add_subdirectory(classlibnative)
-add_subdirectory(dlls)
-add_subdirectory(tools)
-add_subdirectory(unwinder)
-add_subdirectory(interop)
-
-if(CLR_CMAKE_HOST_WIN32)
- add_subdirectory(hosts)
-endif(CLR_CMAKE_HOST_WIN32)
+if(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
+ add_subdirectory(utilcode)
+ add_subdirectory(inc)
+
+ if(CLR_CMAKE_HOST_UNIX)
+ add_subdirectory(palrt)
+ endif(CLR_CMAKE_HOST_UNIX)
+
+ add_subdirectory(ilasm)
+ add_subdirectory(ildasm)
+ add_subdirectory(gcinfo)
+ add_subdirectory(jit)
+ add_subdirectory(vm)
+ add_subdirectory(md)
+ add_subdirectory(debug)
+ add_subdirectory(binder)
+ add_subdirectory(classlibnative)
+ add_subdirectory(dlls)
+ add_subdirectory(tools)
+ add_subdirectory(unwinder)
+ add_subdirectory(interop)
+
+ if(CLR_CMAKE_HOST_WIN32)
+ add_subdirectory(hosts)
+ endif(CLR_CMAKE_HOST_WIN32)
+endif(NOT CLR_CMAKE_HOST_MACCATALYST AND NOT CLR_CMAKE_HOST_IOS AND NOT CLR_CMAKE_HOST_TVOS)
#----------------------------------------------------
# Cross target Component install configuration
diff --git a/src/coreclr/clrdefinitions.cmake b/src/coreclr/clrdefinitions.cmake
index fad480f2aea957..9472c5f88ad720 100644
--- a/src/coreclr/clrdefinitions.cmake
+++ b/src/coreclr/clrdefinitions.cmake
@@ -29,9 +29,9 @@ if (CLR_CMAKE_TARGET_UNIX)
endif(CLR_CMAKE_TARGET_UNIX)
-if (CLR_CMAKE_TARGET_OSX AND CLR_CMAKE_TARGET_ARCH_ARM64)
+if (CLR_CMAKE_TARGET_APPLE AND CLR_CMAKE_TARGET_ARCH_ARM64)
add_compile_definitions($<$>>:OSX_ARM64_ABI>)
-endif(CLR_CMAKE_TARGET_OSX AND CLR_CMAKE_TARGET_ARCH_ARM64)
+endif(CLR_CMAKE_TARGET_APPLE AND CLR_CMAKE_TARGET_ARCH_ARM64)
if(CLR_CMAKE_TARGET_ALPINE_LINUX)
# Alpine Linux doesn't have fixed stack limit, this define disables some stack pointer
@@ -249,9 +249,11 @@ function(set_target_definitions_to_custom_os_and_arch)
elseif (TARGETDETAILS_ARCH STREQUAL "loongarch64")
endif()
if ((TARGETDETAILS_ARCH STREQUAL "arm64") AND (TARGETDETAILS_OS STREQUAL "unix_osx"))
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_APPLE)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE OSX_ARM64_ABI)
endif()
if (TARGETDETAILS_OS STREQUAL "unix_osx")
+ target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_APPLE)
target_compile_definitions(${TARGETDETAILS_TARGET} PRIVATE TARGET_OSX)
endif()
elseif (TARGETDETAILS_OS STREQUAL "win")
diff --git a/src/coreclr/clrfeatures.cmake b/src/coreclr/clrfeatures.cmake
index f82ff1aa4e73e9..85752b0d597959 100644
--- a/src/coreclr/clrfeatures.cmake
+++ b/src/coreclr/clrfeatures.cmake
@@ -36,6 +36,6 @@ if (CLR_CMAKE_TARGET_WIN32 OR CLR_CMAKE_TARGET_UNIX)
set(FEATURE_COMWRAPPERS 1)
endif()
-if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+if (CLR_CMAKE_TARGET_APPLE)
set(FEATURE_OBJCMARSHAL 1)
endif()
diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake
index 7c74eef9c57537..2bd288221192f9 100644
--- a/src/coreclr/crosscomponents.cmake
+++ b/src/coreclr/crosscomponents.cmake
@@ -33,7 +33,7 @@ if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
endif()
endif()
-if(NOT CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_OSX AND NOT FEATURE_CROSSBITNESS)
+if(NOT CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_APPLE AND NOT FEATURE_CROSSBITNESS)
install_clr (TARGETS
mscordaccore
mscordbi
diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
index cc23c118a0ce37..3a5de5794ef789 100644
--- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
+++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
@@ -167,7 +167,7 @@ if(FEATURE_MERGE_JIT_AND_ENGINE)
set(CLRJIT_STATIC clrjit_static)
endif(FEATURE_MERGE_JIT_AND_ENGINE)
-if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST)
+if (CLR_CMAKE_TARGET_OSX)
include(CMakeFindFrameworks)
find_library(FOUNDATION Foundation REQUIRED)
endif()
diff --git a/src/coreclr/gc/CMakeLists.txt b/src/coreclr/gc/CMakeLists.txt
index e2ef118ca0637f..b4e203606d543b 100644
--- a/src/coreclr/gc/CMakeLists.txt
+++ b/src/coreclr/gc/CMakeLists.txt
@@ -112,12 +112,12 @@ install_clr(TARGETS clrgc DESTINATIONS . COMPONENT runtime)
add_definitions(-DBUILD_AS_STANDALONE)
add_definitions(-DFX_VER_INTERNALNAME_STR=clrgc.dll)
add_definitions(-DVERIFY_HEAP)
-if(CLR_CMAKE_HOST_OSX)
- # The implementation of GCToOSInterface on MacOS makes use of non-POSIX
+if(CLR_CMAKE_HOST_APPLE)
+ # The implementation of GCToOSInterface on Apple platforms makes use of non-POSIX
# pthreads APIs, which by default are not included in the pthreads header
# unless we define this macro.
add_definitions(-D_DARWIN_C_SOURCE)
-endif(CLR_CMAKE_HOST_OSX)
+endif(CLR_CMAKE_HOST_APPLE)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/env)
diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp
index c4b719d2bdaddd..6f96102318d4f7 100644
--- a/src/coreclr/gc/gc.cpp
+++ b/src/coreclr/gc/gc.cpp
@@ -24072,9 +24072,9 @@ inline void Prefetch(void* addr)
__prefetch((const char*)addr);
#endif //defined(TARGET_AMD64) || defined(TARGET_X86)
-#elif defined(TARGET_UNIX) || defined(TARGET_OSX)
+#elif defined(TARGET_UNIX)
__builtin_prefetch(addr);
-#else //!(TARGET_WINDOWS || TARGET_UNIX || TARGET_OSX)
+#else //!(TARGET_WINDOWS || TARGET_UNIX)
UNREFERENCED_PARAMETER(addr);
#endif //TARGET_WINDOWS
}
diff --git a/src/coreclr/gc/unix/configure.cmake b/src/coreclr/gc/unix/configure.cmake
index 06dc8d305c6538..7ed3e12211bfb6 100644
--- a/src/coreclr/gc/unix/configure.cmake
+++ b/src/coreclr/gc/unix/configure.cmake
@@ -1,3 +1,13 @@
+include(CheckCXXSourceCompiles)
+include(CheckCXXSourceRuns)
+include(CheckCXXSymbolExists)
+include(CheckFunctionExists)
+include(CheckPrototypeDefinition)
+include(CheckIncludeFiles)
+include(CheckStructHasMember)
+include(CheckTypeSize)
+include(CheckLibraryExists)
+
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/mman.h HAVE_SYS_MMAN_H)
check_include_files(numa.h HAVE_NUMA_H)
diff --git a/src/coreclr/gc/unix/gcenv.unix.cpp b/src/coreclr/gc/unix/gcenv.unix.cpp
index b25194a6173bcd..cb32959c4ef342 100644
--- a/src/coreclr/gc/unix/gcenv.unix.cpp
+++ b/src/coreclr/gc/unix/gcenv.unix.cpp
@@ -235,7 +235,7 @@ bool GCToOSInterface::Initialize()
{
s_flushUsingMemBarrier = TRUE;
}
-#ifndef TARGET_OSX
+#ifndef TARGET_APPLE
else
{
assert(g_helperPage == 0);
@@ -267,7 +267,7 @@ bool GCToOSInterface::Initialize()
return false;
}
}
-#endif // !TARGET_OSX
+#endif // !TARGET_APPLE
InitializeCGroup();
@@ -407,7 +407,7 @@ void GCToOSInterface::FlushProcessWriteBuffers()
status = pthread_mutex_unlock(&g_flushProcessWriteBuffersMutex);
assert(status == 0 && "Failed to unlock the flushProcessWriteBuffersMutex lock");
}
-#ifdef TARGET_OSX
+#ifdef TARGET_APPLE
else
{
mach_msg_type_number_t cThreads;
@@ -421,9 +421,28 @@ void GCToOSInterface::FlushProcessWriteBuffers()
// Iterate through each of the threads in the list.
for (mach_msg_type_number_t i = 0; i < cThreads; i++)
{
- // 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 (__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
+ }
+
if (machret == KERN_INSUFFICIENT_BUFFER_SIZE)
{
CHECK_MACH("thread_get_register_pointer_values()", machret);
@@ -436,7 +455,7 @@ void GCToOSInterface::FlushProcessWriteBuffers()
machret = vm_deallocate(mach_task_self(), (vm_address_t)pThreads, cThreads * sizeof(thread_act_t));
CHECK_MACH("vm_deallocate()", machret);
}
-#endif // TARGET_OSX
+#endif // TARGET_APPLE
}
// Break into a debugger. Uses a compiler intrinsic if one is available,
@@ -824,7 +843,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS()
}
#endif
-#if (defined(HOST_ARM64) || defined(HOST_LOONGARCH64)) && !defined(TARGET_OSX)
+#if (defined(HOST_ARM64) || defined(HOST_LOONGARCH64)) && !defined(TARGET_APPLE)
if (cacheSize == 0)
{
// We expect to get the L3 cache size for Arm64 but currently expected to be missing that info
@@ -874,7 +893,7 @@ static size_t GetLogicalProcessorCacheSizeFromOS()
}
#endif
-#if (defined(HOST_ARM64) || defined(HOST_LOONGARCH64)) && !defined(TARGET_OSX)
+#if (defined(HOST_ARM64) || defined(HOST_LOONGARCH64)) && !defined(TARGET_APPLE)
if (cacheLevel != 3)
{
// We expect to get the L3 cache size for Arm64 but currently expected to be missing that info
diff --git a/src/coreclr/jit/target.h b/src/coreclr/jit/target.h
index cc97831c9f5287..8baf645453adf5 100644
--- a/src/coreclr/jit/target.h
+++ b/src/coreclr/jit/target.h
@@ -19,6 +19,10 @@
#undef TARGET_OSX
#endif
+#ifdef TARGET_APPLE
+#undef TARGET_APPLE
+#endif
+
#ifdef TARGET_WINDOWS
#undef TARGET_WINDOWS
#endif
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
index 5caefcd10b26f1..f6a9b892e03ff1 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -195,6 +195,7 @@ The .NET Foundation licenses this file to you under the MIT license.
+
diff --git a/src/coreclr/nativeaot/CMakeLists.txt b/src/coreclr/nativeaot/CMakeLists.txt
index be8616121bc5ca..91fa37cfad0907 100644
--- a/src/coreclr/nativeaot/CMakeLists.txt
+++ b/src/coreclr/nativeaot/CMakeLists.txt
@@ -26,10 +26,10 @@ if(CLR_CMAKE_HOST_UNIX)
add_compile_options(-fno-exceptions) # Native AOT runtime doesn't use C++ exception handling
add_compile_options(-nostdlib)
- if(CLR_CMAKE_TARGET_OSX)
+ if(CLR_CMAKE_TARGET_APPLE)
add_definitions(-D_XOPEN_SOURCE)
add_definitions(-DFEATURE_OBJCMARSHAL)
- endif(CLR_CMAKE_TARGET_OSX)
+ endif(CLR_CMAKE_TARGET_APPLE)
if(CLR_CMAKE_TARGET_ARCH_AMD64 OR CLR_CMAKE_TARGET_ARCH_I386)
# Allow 16 byte compare-exchange
diff --git a/src/coreclr/nativeaot/Directory.Build.props b/src/coreclr/nativeaot/Directory.Build.props
index 337bffde726f77..799089f2af88dc 100644
--- a/src/coreclr/nativeaot/Directory.Build.props
+++ b/src/coreclr/nativeaot/Directory.Build.props
@@ -60,7 +60,7 @@
false
- true
+ true
FEATURE_OBJCMARSHAL;$(DefineConstants)
diff --git a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ThunkPool.cs b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ThunkPool.cs
index 73bc32ffe36547..7204c3fa9d0118 100644
--- a/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ThunkPool.cs
+++ b/src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ThunkPool.cs
@@ -40,7 +40,7 @@ namespace System.Runtime
{
internal static class Constants
{
-#if TARGET_ARM64 && TARGET_OSX
+#if TARGET_ARM64 && (TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS)
public const uint PageSize = 0x4000; // 16k
public const nuint PageSizeMask = 0x3FFF;
#else
diff --git a/src/coreclr/nativeaot/Runtime/CMakeLists.txt b/src/coreclr/nativeaot/Runtime/CMakeLists.txt
index 8c80cbe2f37a00..8d4e163c1a81e1 100644
--- a/src/coreclr/nativeaot/Runtime/CMakeLists.txt
+++ b/src/coreclr/nativeaot/Runtime/CMakeLists.txt
@@ -169,11 +169,11 @@ else()
set(ASM_SUFFIX S)
endif()
-if (CLR_CMAKE_TARGET_OSX)
+if (CLR_CMAKE_TARGET_APPLE)
list(APPEND COMMON_RUNTIME_SOURCES
interoplibinterface_objc.cpp
)
-endif (CLR_CMAKE_TARGET_OSX)
+endif (CLR_CMAKE_TARGET_APPLE)
if (CLR_CMAKE_TARGET_ARCH_AMD64 AND CLR_CMAKE_TARGET_WIN32)
list(APPEND COMMON_RUNTIME_SOURCES
@@ -238,7 +238,9 @@ if(WIN32)
add_definitions(-DFEATURE_SUSPEND_REDIRECTION)
add_definitions(-DFEATURE_SPECIAL_USER_MODE_APC)
else()
- add_definitions(-DFEATURE_READONLY_GS_COOKIE)
+ if(NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
+ add_definitions(-DFEATURE_READONLY_GS_COOKIE)
+ endif()
add_definitions(-DNO_UI_ASSERT)
include(unix/configure.cmake)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
diff --git a/src/coreclr/nativeaot/Runtime/CommonMacros.h b/src/coreclr/nativeaot/Runtime/CommonMacros.h
index a4a82be3753e59..53467c1a130b4a 100644
--- a/src/coreclr/nativeaot/Runtime/CommonMacros.h
+++ b/src/coreclr/nativeaot/Runtime/CommonMacros.h
@@ -155,7 +155,7 @@ inline bool IS_ALIGNED(T* val, uintptr_t alignment);
#define DATA_ALIGNMENT 8
#ifndef OS_PAGE_SIZE
-#ifdef HOST_OSX
+#ifdef HOST_APPLE
#define OS_PAGE_SIZE 0x4000
#else
#define OS_PAGE_SIZE 0x1000
diff --git a/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp b/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp
index d105f79506aca2..30d3c4722e8a4b 100644
--- a/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp
+++ b/src/coreclr/nativeaot/Runtime/ThunksMapping.cpp
@@ -121,8 +121,14 @@ EXTERN_C NATIVEAOT_API void* __cdecl RhAllocateThunksMapping()
return NULL;
}
-#if defined(HOST_OSX) && defined(HOST_ARM64)
+#if defined(HOST_APPLE) && defined(HOST_ARM64)
+#if defined(HOST_MACCATALYST) || defined(HOST_IOS) || defined(HOST_TVOS)
+ RhFailFast(); // we don't expect to get here on these platforms
+#elif defined(HOST_OSX)
pthread_jit_write_protect_np(0);
+#else
+ #error "Unknown OS"
+#endif
#endif
#endif
@@ -226,8 +232,14 @@ EXTERN_C NATIVEAOT_API void* __cdecl RhAllocateThunksMapping()
}
}
-#if defined(HOST_OSX) && defined(HOST_ARM64)
+#if defined(HOST_APPLE) && defined(HOST_ARM64)
+#if defined(HOST_MACCATALYST) || defined(HOST_IOS) || defined(HOST_TVOS)
+ RhFailFast(); // we don't expect to get here on these platforms
+#elif defined(HOST_OSX)
pthread_jit_write_protect_np(1);
+#else
+ #error "Unknown OS"
+#endif
#else
if (!PalVirtualProtect(pThunksSection, THUNKS_MAP_SIZE, PAGE_EXECUTE_READ))
{
diff --git a/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp b/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp
index d9becd8a1ecfe3..5aecfc0c332111 100644
--- a/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp
+++ b/src/coreclr/nativeaot/Runtime/unix/HardwareExceptions.cpp
@@ -11,7 +11,7 @@
#include "HardwareExceptions.h"
#include "UnixSignals.h"
-#if defined(HOST_OSX)
+#if defined(HOST_APPLE)
#include
#include
#include
@@ -594,7 +594,8 @@ bool InitializeHardwareExceptionHandling()
return false;
}
-#if defined(HOST_OSX)
+#if defined(HOST_APPLE)
+#ifndef HOST_TVOS // task_set_exception_ports is not supported on tvOS
// LLDB installs task-wide Mach exception handlers. XNU dispatches Mach
// exceptions first to any registered "activation" handler and then to
// any registered task handler before dispatching the exception to a
@@ -613,6 +614,7 @@ bool InitializeHardwareExceptionHandling()
EXCEPTION_STATE_IDENTITY,
MACHINE_THREAD_STATE);
ASSERT(kr == KERN_SUCCESS);
+#endif
#endif
return true;
diff --git a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
index 9eb54fb7324b3d..c4f7469d674d83 100644
--- a/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
+++ b/src/coreclr/nativeaot/Runtime/unix/PalRedhawkUnix.cpp
@@ -733,7 +733,7 @@ REDHAWK_PALEXPORT _Ret_maybenull_ _Post_writable_byte_size_(size) void* REDHAWK_
size_t alignedSize = size + (Alignment - OS_PAGE_SIZE);
int flags = MAP_ANON | MAP_PRIVATE;
-#if defined(HOST_OSX) && defined(HOST_ARM64)
+#if defined(HOST_APPLE) && defined(HOST_ARM64)
if (unixProtect & PROT_EXEC)
{
flags |= MAP_JIT;
@@ -795,6 +795,10 @@ REDHAWK_PALEXPORT UInt32_BOOL REDHAWK_PALAPI PalVirtualProtect(_In_ void* pAddre
return mprotect(pPageStart, memSize, unixProtect) == 0;
}
+#if (defined(HOST_MACCATALYST) || defined(HOST_IOS) || defined(HOST_TVOS)) && defined(HOST_ARM64)
+extern "C" void sys_icache_invalidate(const void* start, size_t len);
+#endif
+
REDHAWK_PALEXPORT void PalFlushInstructionCache(_In_ void* pAddress, size_t size)
{
#if defined(__linux__) && defined(HOST_ARM)
@@ -817,6 +821,8 @@ REDHAWK_PALEXPORT void PalFlushInstructionCache(_In_ void* pAddress, size_t size
__builtin___clear_cache((char *)begin, (char *)endOrNextPageBegin);
begin = endOrNextPageBegin;
}
+#elif (defined(HOST_MACCATALYST) || defined(HOST_IOS) || defined(HOST_TVOS)) && defined(HOST_ARM64)
+ sys_icache_invalidate (pAddress, size);
#else
__builtin___clear_cache((char *)pAddress, (char *)pAddress + size);
#endif
@@ -961,8 +967,8 @@ static void ActivationHandler(int code, siginfo_t* siginfo, void* context)
{
// Only accept activations from the current process
if (g_pHijackCallback != NULL && (siginfo->si_pid == getpid()
-#ifdef HOST_OSX
- // On OSX si_pid is sometimes 0. It was confirmed by Apple to be expected, as the si_pid is tracked at the process level. So when multiple
+#ifdef HOST_APPLE
+ // On Apple platforms si_pid is sometimes 0. It was confirmed by Apple to be expected, as the si_pid is tracked at the process level. So when multiple
// signals are in flight in the same process at the same time, it may be overwritten / zeroed.
|| siginfo->si_pid == 0
#endif
diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeLibrary.NativeAot.Unix.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeLibrary.NativeAot.Unix.cs
index 91203aff615c5b..6ef45a24750955 100644
--- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeLibrary.NativeAot.Unix.cs
+++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/InteropServices/NativeLibrary.NativeAot.Unix.cs
@@ -39,7 +39,7 @@ internal struct LoadLibErrorTracker
public void Throw(string libraryName)
{
-#if TARGET_OSX
+#if TARGET_OSX || TARGET_MACCATALYST || TARGET_IOS || TARGET_TVOS
throw new DllNotFoundException(SR.Format(SR.DllNotFound_Mac, libraryName, _errorMessage));
#else
throw new DllNotFoundException(SR.Format(SR.DllNotFound_Linux, libraryName, _errorMessage));
diff --git a/src/coreclr/pal/inc/rt/palrt.h b/src/coreclr/pal/inc/rt/palrt.h
index ee73da2dc00fc8..fffc116766f9c0 100644
--- a/src/coreclr/pal/inc/rt/palrt.h
+++ b/src/coreclr/pal/inc/rt/palrt.h
@@ -1079,8 +1079,6 @@ typedef struct _DISPATCHER_CONTEXT {
#endif
-// #endif // !defined(TARGET_OSX)
-
typedef DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT;
#define ExceptionContinueSearch EXCEPTION_CONTINUE_SEARCH
diff --git a/src/coreclr/tools/Common/CommandLineHelpers.cs b/src/coreclr/tools/Common/CommandLineHelpers.cs
index 39161e2c753b07..8ee9a79260d1ef 100644
--- a/src/coreclr/tools/Common/CommandLineHelpers.cs
+++ b/src/coreclr/tools/Common/CommandLineHelpers.cs
@@ -77,8 +77,11 @@ public static TargetOS GetTargetOS(string token)
"linux" => TargetOS.Linux,
"freebsd" => TargetOS.FreeBSD,
"osx" => TargetOS.OSX,
+ "maccatalyst" => TargetOS.MacCatalyst,
"ios" => TargetOS.iOS,
"iossimulator" => TargetOS.iOSSimulator,
+ "tvos" => TargetOS.tvOS,
+ "tvossimulator" => TargetOS.tvOSSimulator,
_ => throw new CommandLineException($"Target OS '{token}' is not supported")
};
}
diff --git a/src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs b/src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs
index 39a3c20f45a20b..38eb48be322153 100644
--- a/src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs
+++ b/src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs
@@ -15,12 +15,15 @@ public enum TargetOS
Windows,
Linux,
OSX,
+ MacCatalyst,
+ iOS,
+ iOSSimulator,
+ tvOS,
+ tvOSSimulator,
FreeBSD,
NetBSD,
SunOS,
- WebAssembly,
- iOS,
- iOSSimulator
+ WebAssembly
}
public enum TargetAbi
@@ -306,15 +309,18 @@ public bool IsWindows
///
/// Returns True if compiling for OSX family of operating systems.
- /// Currently including OSX, iOS and iOSSimulator
+ /// Currently including OSX, MacCatalyst, iOS, iOSSimulator, tvOS and tvOSSimulator
///
public bool IsOSXLike
{
get
{
return OperatingSystem == TargetOS.OSX ||
+ OperatingSystem == TargetOS.MacCatalyst ||
OperatingSystem == TargetOS.iOS ||
- OperatingSystem == TargetOS.iOSSimulator;
+ OperatingSystem == TargetOS.iOSSimulator ||
+ OperatingSystem == TargetOS.tvOS ||
+ OperatingSystem == TargetOS.tvOSSimulator;
}
}
diff --git a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs
index 120e9a81692ca0..b42db28d6f2445 100644
--- a/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs
+++ b/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs
@@ -1250,6 +1250,11 @@ private static string GetLLVMTripleFromTarget(TargetDetails target)
sys = "darwin16";
abi = "macho";
break;
+ case TargetOS.MacCatalyst:
+ vendor = "apple";
+ sys = target.Architecture == TargetArchitecture.X64 ? "ios13.5" :"ios14.2";
+ abi = "macabi";
+ break;
case TargetOS.iOS:
vendor = "apple";
sys = "ios11.0";
@@ -1260,6 +1265,16 @@ private static string GetLLVMTripleFromTarget(TargetDetails target)
sys = "ios11.0";
abi = "simulator";
break;
+ case TargetOS.tvOS:
+ vendor = "apple";
+ sys = "tvos11.0";
+ abi = "macho";
+ break;
+ case TargetOS.tvOSSimulator:
+ vendor = "apple";
+ sys = "tvos11.0";
+ abi = "simulator";
+ break;
case TargetOS.WebAssembly:
vendor = "unknown";
sys = "unknown";
diff --git a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
index 235b7443e55482..b852cbecf10f27 100644
--- a/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
+++ b/src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
@@ -306,7 +306,7 @@ public static IEnumerable> GetExtendedHelp(HelpContext _)
"considered to be input files. If no input files begin with '--' then this option is not necessary.\n");
string[] ValidArchitectures = new string[] { "arm", "arm64", "x86", "x64" };
- string[] ValidOS = new string[] { "windows", "linux", "freebsd", "osx", "ios", "iossimulator" };
+ string[] ValidOS = new string[] { "windows", "linux", "freebsd", "osx", "maccatalyst", "ios", "iossimulator", "tvos", "tvossimulator" };
Console.WriteLine("Valid switches for {0} are: '{1}'. The default value is '{2}'\n", "--targetos", string.Join("', '", ValidOS), Helpers.GetTargetOS(null).ToString().ToLowerInvariant());
diff --git a/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-arm64.xml b/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-arm64.xml
index 39dd1f17e0e0ec..1b0dca06e4095d 100644
--- a/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-arm64.xml
+++ b/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-arm64.xml
@@ -6,6 +6,7 @@
+
diff --git a/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-x64.xml b/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-x64.xml
index 7852e37e9551de..419795e0f348fe 100644
--- a/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-x64.xml
+++ b/src/installer/pkg/sfx/bundle/shared-framework-distribution-template-x64.xml
@@ -6,6 +6,7 @@
+
diff --git a/src/libraries/Common/src/Interop/Interop.ICU.iOS.cs b/src/libraries/Common/src/Interop/Interop.ICU.iOS.cs
index 42df7e7f97ceec..6a20612dc47eea 100644
--- a/src/libraries/Common/src/Interop/Interop.ICU.iOS.cs
+++ b/src/libraries/Common/src/Interop/Interop.ICU.iOS.cs
@@ -9,6 +9,6 @@ internal static partial class Interop
internal static partial class Globalization
{
[LibraryImport(Libraries.GlobalizationNative, EntryPoint = "GlobalizationNative_LoadICUData", StringMarshalling = StringMarshalling.Utf8)]
- internal static partial int LoadICUData(string path);
+ internal static partial int LoadICUData(string? path);
}
}
diff --git a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.LoadICU.iOS.cs b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.LoadICU.iOS.cs
index 08c5feb8ad1898..cf3185101e608e 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.LoadICU.iOS.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Globalization/GlobalizationMode.LoadICU.iOS.cs
@@ -7,8 +7,7 @@ internal static partial class GlobalizationMode
{
private static int LoadICU()
{
- object? datPath = AppContext.GetData("ICU_DAT_FILE_PATH");
- return (datPath != null) ? Interop.Globalization.LoadICUData(datPath!.ToString()!) : Interop.Globalization.LoadICU();
+ return Interop.Globalization.LoadICUData((string?)AppContext.GetData("ICU_DAT_FILE_PATH")); // we handle a null path in the native code
}
}
}
diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt
index 89c51af5645ddf..aefd461500bd3e 100644
--- a/src/native/corehost/apphost/static/CMakeLists.txt
+++ b/src/native/corehost/apphost/static/CMakeLists.txt
@@ -9,7 +9,7 @@ set(DOTNET_PROJECT_NAME "singlefilehost")
# dependencies is not possible for some reason.
# This cannot be enabled for MacOS (Darwin) since its RPATH works in a different way,
# doesn't apply to libraries loaded via dlopen and most importantly, it is not transitive.
-if (NOT CLR_CMAKE_TARGET_OSX)
+if (NOT CLR_CMAKE_TARGET_APPLE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "\$ORIGIN/netcoredeps")
endif()
@@ -151,23 +151,27 @@ else()
include(${CLR_SRC_NATIVE_DIR}/libs/System.IO.Compression.Native/extra_libs.cmake)
append_extra_compression_libs(NATIVE_LIBS)
- # Additional requirements for System.Net.Security.Native
- include(${CLR_SRC_NATIVE_DIR}/libs/System.Net.Security.Native/extra_libs.cmake)
- append_extra_security_libs(NATIVE_LIBS)
+ if (NOT CLR_CMAKE_TARGET_TVOS) # no gssapi on tvOS, see https://developer.apple.com/documentation/gss
+ # Additional requirements for System.Net.Security.Native
+ include(${CLR_SRC_NATIVE_DIR}/libs/System.Net.Security.Native/extra_libs.cmake)
+ append_extra_security_libs(NATIVE_LIBS)
+ endif()
# Additional requirements for System.Native
include(${CLR_SRC_NATIVE_DIR}/libs/System.Native/extra_libs.cmake)
append_extra_system_libs(NATIVE_LIBS)
- # Additional requirements for System.Security.Cryptography.Native.OpenSsl
- include(${CLR_SRC_NATIVE_DIR}/libs/System.Security.Cryptography.Native/extra_libs.cmake)
- append_extra_cryptography_libs(NATIVE_LIBS)
+ if(NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS)
+ # Additional requirements for System.Security.Cryptography.Native.OpenSsl
+ include(${CLR_SRC_NATIVE_DIR}/libs/System.Security.Cryptography.Native/extra_libs.cmake)
+ append_extra_cryptography_libs(NATIVE_LIBS)
+ endif()
set(RUNTIMEINFO_LIB runtimeinfo)
endif()
-if(CLR_CMAKE_TARGET_OSX)
+if(CLR_CMAKE_TARGET_APPLE)
LIST(APPEND NATIVE_LIBS
System.Security.Cryptography.Native.Apple-Static
)
@@ -180,7 +184,7 @@ endif()
#
# Additional requirements for coreclr
#
-if(CLR_CMAKE_TARGET_OSX)
+if(CLR_CMAKE_TARGET_APPLE)
find_library(COREFOUNDATION CoreFoundation)
find_library(CORESERVICES CoreServices)
find_library(SECURITY Security)
@@ -202,14 +206,14 @@ elseif (CLR_CMAKE_TARGET_SUNOS)
LIST(APPEND NATIVE_LIBS
socket
)
-endif(CLR_CMAKE_TARGET_OSX)
+endif(CLR_CMAKE_TARGET_APPLE)
# On *BSD, we always use the libunwind that's part of the OS
if(CLR_CMAKE_TARGET_FREEBSD)
set(CLR_CMAKE_USE_SYSTEM_LIBUNWIND 1)
endif()
-if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_OSX)
+if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_APPLE)
find_unwind_libs(UNWIND_LIBS)
LIST(APPEND NATIVE_LIBS
@@ -223,11 +227,11 @@ if(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD
set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive)
endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS)
-if(CLR_CMAKE_TARGET_OSX)
+if(CLR_CMAKE_TARGET_APPLE)
# These options are used to force every object to be included even if it's unused.
set(START_WHOLE_ARCHIVE -force_load)
set(END_WHOLE_ARCHIVE )
-endif(CLR_CMAKE_TARGET_OSX)
+endif(CLR_CMAKE_TARGET_APPLE)
set_property(TARGET singlefilehost PROPERTY ENABLE_EXPORTS 1)
diff --git a/src/native/external/llvm-libunwind.cmake b/src/native/external/llvm-libunwind.cmake
index a30f03027f8c7f..a6f7ddf8cb5ba6 100644
--- a/src/native/external/llvm-libunwind.cmake
+++ b/src/native/external/llvm-libunwind.cmake
@@ -7,7 +7,7 @@ set (LLVM_LIBUNWIND_SOURCES_BASE
src/libunwind.cpp
)
-if(CLR_CMAKE_TARGET_OSX)
+if(CLR_CMAKE_TARGET_APPLE)
set(LLVM_LIBUNWIND_SOURCES_BASE
${LLVM_LIBUNWIND_SOURCES_BASE}
src/Unwind_AppleExtras.cpp
diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt
index 6dde2f698bda74..f72e04b4005323 100644
--- a/src/native/libs/CMakeLists.txt
+++ b/src/native/libs/CMakeLists.txt
@@ -121,7 +121,7 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
message(FATAL_ERROR "Unknown build type. Set CMAKE_BUILD_TYPE to DEBUG or RELEASE.")
endif ()
- if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ if (CLR_CMAKE_TARGET_APPLE)
add_definitions(-D__APPLE_USE_RFC_3542)
endif ()
@@ -184,7 +184,7 @@ if (CLR_CMAKE_TARGET_UNIX OR CLR_CMAKE_TARGET_BROWSER OR CLR_CMAKE_TARGET_WASI)
add_subdirectory(System.Security.Cryptography.Native)
endif ()
- if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ if (CLR_CMAKE_TARGET_APPLE)
add_subdirectory(System.Security.Cryptography.Native.Apple)
endif ()
endif ()
diff --git a/src/native/libs/System.Globalization.Native/CMakeLists.txt b/src/native/libs/System.Globalization.Native/CMakeLists.txt
index bbf9737d6e135d..60a547b001e552 100644
--- a/src/native/libs/System.Globalization.Native/CMakeLists.txt
+++ b/src/native/libs/System.Globalization.Native/CMakeLists.txt
@@ -73,7 +73,7 @@ else()
set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_icushim.c)
endif()
-if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+if (CLR_CMAKE_TARGET_APPLE)
set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_locale.m)
endif()
@@ -93,7 +93,7 @@ endif()
include_directories("../Common")
if (GEN_SHARED_LIB)
- if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ if (CLR_CMAKE_TARGET_APPLE)
include(CMakeFindFrameworks)
find_library(FOUNDATION Foundation REQUIRED)
endif()
@@ -123,7 +123,7 @@ endif()
install (TARGETS System.Globalization.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs)
-if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID)
+if(NOT CLR_CMAKE_TARGET_APPLE AND NOT CLR_CMAKE_TARGET_ANDROID)
if (GEN_SHARED_LIB)
add_custom_command(TARGET System.Globalization.Native POST_BUILD
COMMENT "Verifying System.Globalization.Native.so dependencies"
diff --git a/src/native/libs/System.Globalization.Native/pal_icushim_internal.h b/src/native/libs/System.Globalization.Native/pal_icushim_internal.h
index e349b47f288022..77f7a82350e263 100644
--- a/src/native/libs/System.Globalization.Native/pal_icushim_internal.h
+++ b/src/native/libs/System.Globalization.Native/pal_icushim_internal.h
@@ -340,4 +340,8 @@ FOR_ALL_ICU_FUNCTIONS
#define ucal_getWindowsTimeZoneID_ptr ucal_getWindowsTimeZoneID
#define ucal_getTimeZoneIDForWindowsID_ptr ucal_getTimeZoneIDForWindowsID
+#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS)
+const char* GlobalizationNative_GetICUDataPathFallback(void);
+#endif
+
#endif // !defined(STATIC_ICU)
diff --git a/src/native/libs/System.Globalization.Native/pal_icushim_static.c b/src/native/libs/System.Globalization.Native/pal_icushim_static.c
index cd57172b52329e..ce64ca70dac5be 100644
--- a/src/native/libs/System.Globalization.Native/pal_icushim_static.c
+++ b/src/native/libs/System.Globalization.Native/pal_icushim_static.c
@@ -169,6 +169,14 @@ cstdlib_load_icu_data(const char *path)
int32_t
GlobalizationNative_LoadICUData(const char* path)
{
+#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS)
+ if (!path)
+ {
+ // fallback to icudt.dat in the app bundle root in case the path isn't set
+ path = GlobalizationNative_GetICUDataPathFallback();
+ }
+#endif
+
const char *icu_data = cstdlib_load_icu_data(path);
if (icu_data == NULL)
diff --git a/src/native/libs/System.Globalization.Native/pal_locale.m b/src/native/libs/System.Globalization.Native/pal_locale.m
index f574b9d14797e3..2968735694fc44 100644
--- a/src/native/libs/System.Globalization.Native/pal_locale.m
+++ b/src/native/libs/System.Globalization.Native/pal_locale.m
@@ -28,3 +28,10 @@
return strdup([localeName UTF8String]);
}
+#if defined(TARGET_MACCATALYST) || defined(TARGET_IOS) || defined(TARGET_TVOS)
+const char* GlobalizationNative_GetICUDataPathFallback(void)
+{
+ NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"icudt" ofType:@"dat"];
+ return strdup([bundlePath UTF8String]);
+}
+#endif
diff --git a/src/native/libs/System.Native/CMakeLists.txt b/src/native/libs/System.Native/CMakeLists.txt
index d44823c951354c..eb3853a81c1cd3 100644
--- a/src/native/libs/System.Native/CMakeLists.txt
+++ b/src/native/libs/System.Native/CMakeLists.txt
@@ -52,7 +52,7 @@ else()
)
endif()
-if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+if (CLR_CMAKE_TARGET_APPLE)
list (APPEND NATIVE_SOURCES pal_autoreleasepool.m)
set_source_files_properties(pal_autoreleasepool.m PROPERTIES COMPILE_FLAGS -fno-objc-arc)
else()
diff --git a/src/native/libs/System.Native/extra_libs.cmake b/src/native/libs/System.Native/extra_libs.cmake
index 2edc74bde7aaff..b0fe86b69f4cc0 100644
--- a/src/native/libs/System.Native/extra_libs.cmake
+++ b/src/native/libs/System.Native/extra_libs.cmake
@@ -10,7 +10,7 @@ macro(append_extra_system_libs NativeLibsExtra)
list(APPEND ${NativeLibsExtra} socket)
endif ()
- if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+ if (CLR_CMAKE_TARGET_APPLE)
include(CMakeFindFrameworks)
find_library(FOUNDATION Foundation REQUIRED)
list(APPEND ${NativeLibsExtra} ${FOUNDATION})
diff --git a/src/native/libs/build-native.sh b/src/native/libs/build-native.sh
index ad5936423120e3..934070b69357cf 100755
--- a/src/native/libs/build-native.sh
+++ b/src/native/libs/build-native.sh
@@ -102,7 +102,7 @@ elif [[ "$__TargetOS" == iossimulator ]]; then
elif [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
else
- echo "Error: Unknown iossimulator architecture $__TargetArch."
+ echo "Error: Unknown iOS Simulator architecture $__TargetArch."
exit 1
fi
elif [[ "$__TargetOS" == ios ]]; then
@@ -114,7 +114,7 @@ elif [[ "$__TargetOS" == ios ]]; then
elif [[ "$__TargetArch" == arm ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"armv7;armv7s\" $__CMakeArgs"
else
- echo "Error: Unknown ios architecture $__TargetArch."
+ echo "Error: Unknown iOS architecture $__TargetArch."
exit 1
fi
elif [[ "$__TargetOS" == tvossimulator ]]; then
@@ -126,7 +126,7 @@ elif [[ "$__TargetOS" == tvossimulator ]]; then
elif [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
else
- echo "Error: Unknown tvossimulator architecture $__TargetArch."
+ echo "Error: Unknown tvOS Simulator architecture $__TargetArch."
exit 1
fi
elif [[ "$__TargetOS" == tvos ]]; then
@@ -136,7 +136,7 @@ elif [[ "$__TargetOS" == tvos ]]; then
if [[ "$__TargetArch" == arm64 ]]; then
__CMakeArgs="-DCMAKE_OSX_ARCHITECTURES=\"arm64\" $__CMakeArgs"
else
- echo "Error: Unknown tvos architecture $__TargetArch."
+ echo "Error: Unknown tvOS architecture $__TargetArch."
exit 1
fi
fi
diff --git a/src/tests/Interop/CMakeLists.txt b/src/tests/Interop/CMakeLists.txt
index 2d9e84209b2cfd..21e83b1f9f370f 100644
--- a/src/tests/Interop/CMakeLists.txt
+++ b/src/tests/Interop/CMakeLists.txt
@@ -100,7 +100,7 @@ if(CLR_CMAKE_TARGET_UNIX)
add_subdirectory(COM/ComWrappers/WeakReference)
endif(CLR_CMAKE_TARGET_UNIX)
-if(CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS)
+if(CLR_CMAKE_TARGET_APPLE)
add_subdirectory(ObjectiveC/AutoReleaseTest)
add_subdirectory(ObjectiveC/ObjectiveCMarshalAPI)
endif()