In the mono build we've been setting HOST_IOS/TARGET_IOS when targeting tvOS which differs from the other runtime repo build systems and caused confusion. This aligns the defines so we only set the iOS ones on iOS and not on tvOS.
Also removes mono_dl_get_system_dir() since it was not actually used.
# control cross-compiling to ios
add_definitions(-D_THREAD_SAFE)
set(HOST_DARWIN 1)
- set(HOST_IOS 1)
- if(CLR_CMAKE_HOST_OS STREQUAL "tvos")
+ if(CLR_CMAKE_HOST_OS STREQUAL "ios")
+ set(HOST_IOS 1)
+ elseif(CLR_CMAKE_HOST_OS STREQUAL "tvos")
set(HOST_TVOS 1)
endif()
set(PTHREAD_POINTER_ID 1)
elseif(TARGET_SYSTEM_NAME STREQUAL "ios" OR TARGET_SYSTEM_NAME STREQUAL "tvos")
set(TARGET_UNIX 1)
set(TARGET_MACH 1)
- set(TARGET_IOS 1)
set(TARGET_DARWIN 1)
- if(TARGET_SYSTEM_NAME STREQUAL "tvos")
+ set(TARGET_APPLE_MOBILE 1)
+ if(TARGET_SYSTEM_NAME STREQUAL "ios")
+ set(TARGET_IOS 1)
+ elseif(TARGET_SYSTEM_NAME STREQUAL "tvos")
set(TARGET_TVOS 1)
endif()
- set(TARGET_APPLE_MOBILE 1)
elseif(TARGET_SYSTEM_NAME STREQUAL "linux")
set(TARGET_UNIX 1)
set(TARGET_LINUX 1)
set(HAVE_SYS_ICU 1)
set(STATIC_ICU 1)
set(ICU_LIBS "icucore")
-elseif(HOST_IOS OR HOST_MACCAT)
+elseif(HOST_IOS OR HOST_TVOS OR HOST_MACCAT)
set(ICU_FLAGS "-DTARGET_UNIX -DU_DISABLE_RENAMING -Wno-reserved-id-macro -Wno-documentation -Wno-documentation-unknown-command -Wno-switch-enum -Wno-covered-switch-default -Wno-extra-semi-stmt -Wno-unknown-warning-option -Wno-deprecated-declarations")
set(HAVE_SYS_ICU 1)
set(STATIC_ICU 1)
######################################
# OS SPECIFIC CHECKS
######################################
-if(HOST_IOS OR HOST_ANDROID OR HOST_MACCAT)
+if(HOST_IOS OR HOST_TVOS OR HOST_ANDROID OR HOST_MACCAT)
# FIXME: the mobile products use mono_dllmap_insert so allow this
unset(DISABLE_DLLMAP)
else()
add_subdirectory("${CLR_SRC_NATIVE_DIR}/public" public_apis)
add_subdirectory(mono)
-if (ENABLE_MSCORDBI AND NOT TARGET_ARCH STREQUAL "arm64" AND NOT CMAKE_CROSSCOMPILING AND NOT TARGET_IOS AND NOT TARGET_ANDROID AND NOT TARGET_BROWSER AND NOT TARGET_WASI AND NOT HOST_MACCAT)
+if (ENABLE_MSCORDBI AND NOT TARGET_ARCH STREQUAL "arm64" AND NOT CMAKE_CROSSCOMPILING AND NOT TARGET_IOS AND NOT TARGET_TVOS AND NOT TARGET_ANDROID AND NOT TARGET_BROWSER AND NOT TARGET_WASI AND NOT HOST_MACCAT)
add_subdirectory(dlls/mscordbi)
endif()
check_include_files("sys/types.h;sys/user.h" HAVE_SYS_USER_H)
-if(HOST_IOS OR HOST_MACCAT)
+if(HOST_IOS OR HOST_TVOS OR HOST_MACCAT)
# getentropy isn't allowed in the AppStore: https://github.com/rust-lang/rust/issues/102643
set(HAVE_GETENTROPY 0)
endif()
set(HAVE_STRUCT_SOCKADDR_IN6 1)
set(HAVE_STRTOK_R 1)
set(HAVE_EXECVP 0)
-elseif(HOST_IOS)
+elseif(HOST_IOS OR HOST_TVOS)
set(HAVE_SYSTEM 0)
set(HAVE_SYS_USER_H 0)
if(HOST_TVOS)
#endif
/*
- * On iOS we can't use System.Environment.Exit () as it will do the wrong
+ * On iOS/tvOS we can't use System.Environment.Exit () as it will do the wrong
* shutdown sequence.
*/
-#if !defined (TARGET_IOS)
+#if !defined (TARGET_IOS) && !defined(TARGET_TVOS)
#define TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT
#endif
}
mono_runtime_printf_err ("[ERROR] FATAL UNHANDLED EXCEPTION: %s", msg);
g_free (msg);
-#if defined(HOST_IOS)
+#if defined(HOST_IOS) || defined(HOST_TVOS)
g_assertion_message ("Terminating runtime due to unhandled exception");
#else
exit (mono_environment_exitcode_get ());
if(CMAKE_SYSTEM_VARIANT STREQUAL "maccatalyst")
set(OS_LIBS ${OS_LIBS} "-lobjc" "-lc++")
endif()
-elseif(HOST_IOS)
+elseif(HOST_IOS OR HOST_TVOS)
set(OS_LIBS "-framework CoreFoundation" "-lobjc" "-lc++")
elseif(HOST_ANDROID)
set(OS_LIBS m dl log)
DW_AT_MIPS_linkage_name, DW_FORM_string,
DW_AT_decl_file , DW_FORM_udata,
DW_AT_decl_line , DW_FORM_udata,
-#ifndef TARGET_IOS
+#if !defined (TARGET_IOS) && !defined(TARGET_TVOS)
DW_AT_description , DW_FORM_string,
#endif
DW_AT_low_pc , DW_FORM_addr,
emit_uleb128 (w, 0);
emit_uleb128 (w, 0);
}
-#ifndef TARGET_IOS
+#if !defined (TARGET_IOS) && !defined(TARGET_TVOS)
emit_string (w, name);
#endif
g_free (name);
for (i = 0; i < 16; ++i)
regs [i] = new_ctx->regs [i];
-#ifdef TARGET_IOS
+#if defined (TARGET_IOS) || defined(TARGET_TVOS)
/* On IOS, d8..d15 are callee saved. They are mapped to 8..15 in unwind.c */
for (i = 0; i < 8; ++i)
regs [MONO_MAX_IREGS + i] = *(guint64*)&(new_ctx->fregs [8 + i]);
new_ctx->regs [i] = regs [i];
new_ctx->pc = regs [ARMREG_LR];
new_ctx->regs [ARMREG_SP] = (gsize)cfa;
-#ifdef TARGET_IOS
+#if defined (TARGET_IOS) || defined(TARGET_TVOS)
for (i = 0; i < 8; ++i)
new_ctx->fregs [8 + i] = *(double*)&(regs [MONO_MAX_IREGS + i]);
#endif
#else
arm_fpu = MONO_ARM_FPU_VFP;
-#if defined(ARM_FPU_NONE) && !defined(TARGET_IOS)
+#if defined(ARM_FPU_NONE) && !defined(TARGET_IOS) && !defined(TARGET_TVOS)
/*
* If we're compiling with a soft float fallback and it
* turns out that no VFP unit is available, we need to
v7_supported = TRUE;
#endif
-#if defined(TARGET_IOS)
+#if defined(TARGET_IOS) || defined(TARGET_TVOS)
/* iOS is special-cased here because we don't yet
have a way to properly detect CPU features on it. */
thumb_supported = TRUE;
void
mono_arch_init (void)
{
-#if defined(TARGET_IOS) || defined(TARGET_WATCHOS) || defined(TARGET_OSX)
+#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_WATCHOS) || defined(TARGET_OSX)
ios_abi = TRUE;
#endif
#ifdef MONO_ARCH_ENABLE_PTRAUTH
gboolean
mono_arch_have_fast_tls (void)
{
-#ifdef TARGET_IOS
+#if defined(TARGET_IOS) || defined(TARGET_TVOS)
return FALSE;
#else
return TRUE;
// can pass context to generics or interfaces?
#define MONO_ARCH_HAVE_VOLATILE_NON_PARAM_REGISTER 1
-#ifdef TARGET_IOS
+#if defined(TARGET_IOS) || defined(TARGET_TVOS)
#define MONO_ARCH_REDZONE_SIZE 128
#endif
-#if defined(TARGET_IOS) || defined(TARGET_WATCHOS)
+#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_WATCHOS)
#define MONO_ARCH_HAVE_UNWIND_BACKTRACE 1
#endif
register_icall_no_wrapper (mono_monitor_enter_fast, mono_icall_sig_int_obj);
register_icall_no_wrapper (mono_monitor_enter_v4_fast, mono_icall_sig_int_obj_ptr);
-#ifdef TARGET_IOS
+#if defined(TARGET_IOS) || defined(TARGET_TVOS)
register_icall (pthread_getspecific, mono_icall_sig_ptr_ptr, TRUE);
#endif
/* Register tls icalls */
#pragma warning(disable:4312) // FIXME pointer cast to different size
#endif
-#if defined (HOST_ANDROID) || defined (TARGET_IOS)
+#if defined (HOST_ANDROID) || defined (TARGET_IOS) || defined(TARGET_TVOS)
# undef printf
# define printf(...) g_log("mono", G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
# undef fprintf
if self.arch_define:
ret.append (self.arch_define)
if self.platform_define:
- ret.append (self.platform_define)
+ if isinstance(self.platform_define, list):
+ ret.extend (self.platform_define)
+ else:
+ ret.append (self.platform_define)
if self.defines:
ret.extend (self.defines)
return ret
self.target_args += ["-I", prefix + "/include"]
self.target_args += ["-I", prefix + "/include-fixed"]
- # iOS
- elif "arm-apple-darwin10" == args.abi:
- require_sysroot (args)
- self.target = Target ("TARGET_ARM", "TARGET_IOS", ["ARM_FPU_VFP", "HAVE_ARMV5"] + IOS_DEFINES)
- self.target_args += ["-arch", "arm"]
- self.target_args += ["-isysroot", args.sysroot]
+ # iOS/tvOS
elif "aarch64-apple-darwin10" == args.abi:
require_sysroot (args)
- self.target = Target ("TARGET_ARM64", "TARGET_IOS", IOS_DEFINES)
+ self.target = Target ("TARGET_ARM64", ["TARGET_IOS", "TARGET_TVOS"], IOS_DEFINES)
self.target_args += ["-arch", "arm64"]
self.target_args += ["-isysroot", args.sysroot]
- elif "i386-apple-darwin10" == args.abi:
- require_sysroot (args)
- self.target = Target ("TARGET_X86", "", IOS_DEFINES)
- self.target_args += ["-arch", "i386"]
- self.target_args += ["-isysroot", args.sysroot]
elif "x86_64-apple-darwin10" == args.abi:
require_sysroot (args)
self.target = Target ("TARGET_AMD64", "", IOS_DEFINES)
if target.arch_define:
f.write ("#ifdef " + target.arch_define + "\n")
if target.platform_define:
- f.write ("#ifdef " + target.platform_define + "\n")
+ if isinstance(target.platform_define, list):
+ f.write ("#if " + " || ".join (["defined (" + platform_define + ")" for platform_define in target.platform_define]) + "\n")
+ else:
+ f.write ("#ifdef " + target.platform_define + "\n")
f.write ("#ifndef HAVE_BOEHM_GC\n")
f.write ("#define HAS_CROSS_COMPILER_OFFSETS\n")
f.write ("#if defined (USE_CROSS_COMPILE_OFFSETS) || defined (MONO_CROSS_COMPILE)\n")
if target.arch_define:
f.write ("#endif //" + target.arch_define + "\n")
if target.platform_define:
- f.write ("#endif //" + target.platform_define + "\n")
+ if isinstance(target.platform_define, list):
+ f.write ("#endif //" + " || ".join (target.platform_define) + "\n")
+ else:
+ f.write ("#endif //" + target.platform_define + "\n")
f.write ("#endif //USED_CROSS_COMPILER_OFFSETS check\n")
tool = OffsetsTool ()
return gcc_sync_val_compare_and_swap (dest, comp, exch);
}
-#elif defined (__arm__) && defined (HAVE_ARMV7) && (defined(TARGET_IOS) || defined(TARGET_WATCHOS) || defined(TARGET_ANDROID))
+#elif defined (__arm__) && defined (HAVE_ARMV7) && (defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_WATCHOS) || defined(TARGET_ANDROID))
#ifdef MONO_ATOMIC_USES_LOCK
#error MONO_ATOMIC_USES_LOCK defined
#endif
-#if defined (TARGET_IOS) || defined (TARGET_WATCHOS)
+#if defined (TARGET_IOS) || defined (TARGET_TVOS) || defined (TARGET_WATCHOS)
#ifndef __clang__
#error "Not supported."
#if defined (WAPI_NO_ATOMIC_ASM)
#define MONO_ATOMIC_USES_LOCK
#elif defined(BROKEN_64BIT_ATOMICS_INTRINSIC)
-#if !defined(TARGET_OSX) && !(defined (__arm__) && defined (HAVE_ARMV7) && (defined(TARGET_IOS) || defined(TARGET_WATCHOS) || defined(TARGET_ANDROID)))
+#if !defined(TARGET_OSX) && !(defined (__arm__) && defined (HAVE_ARMV7) && (defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_WATCHOS) || defined(TARGET_ANDROID)))
#define MONO_ATOMIC_USES_LOCK
#endif
#endif
return suffixes;
}
-const char*
-mono_dl_get_system_dir (void)
-{
-#ifdef TARGET_IOS
- /* IOS9 can't load system libraries using relative paths, i.e. 'libc' doesn't work, but '/usr/lib/libc' does. */
- return "/usr/lib";
-#else
- return NULL;
-#endif
-}
-
#else
#include <mono/utils/mono-compiler.h>
return suffixes;
}
-const char*
-mono_dl_get_system_dir (void)
-{
- return NULL;
-}
-
#endif
void *
return suffixes;
}
-const char*
-mono_dl_get_system_dir (void)
-{
- return NULL;
-}
-
-
void*
mono_dl_lookup_symbol (MonoDl *module, const char *name)
{
}
#endif /* HAVE_API_SUPPORT_WIN32_FORMAT_MESSAGE */
-const char*
-mono_dl_get_system_dir (void)
-{
- return NULL;
-}
-
#else
#include <mono/utils/mono-compiler.h>
void* mono_dl_lookup_symbol (MonoDl *module, const char *name);
int mono_dl_convert_flags (int mono_flags, int native_flags);
char* mono_dl_current_error_string (void);
-const char* mono_dl_get_system_dir (void);
#endif /* __MONO_UTILS_DL_H__ */
#define mono_trace_warning(...) (mono_trace (G_LOG_LEVEL_WARNING, __VA_ARGS__))
#define mono_trace_message(...) (mono_trace (G_LOG_LEVEL_MESSAGE, __VA_ARGS__))
-#if defined (HOST_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
+#if defined (HOST_ANDROID) || defined (TARGET_IOS) || defined (TARGET_TVOS)
#define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format, ##__VA_ARGS__)
#define mono_runtime_printf(format, ...) g_log ("mono-rt", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
#define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_edi)
#define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.mc_eip)
#elif defined(__APPLE__)
-# if defined (TARGET_IOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
+# if defined (TARGET_IOS) || defined (TARGET_TVOS) || (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5)
#define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__eax)
#define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__ebx)
#define UCONTEXT_REG_ECX(ctx) (((ucontext_t*)(ctx))->uc_mcontext->__ss.__ecx)