Skip to content

Commit b8653d9

Browse files
authored
[mono] Align HOST_TVOS/TARGET_TVOS defines with the rest of the repo (#89085)
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.
1 parent 3dcf48e commit b8653d9

22 files changed

+47
-77
lines changed

src/mono/CMakeLists.txt

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ elseif(CLR_CMAKE_HOST_OS STREQUAL "ios" OR CLR_CMAKE_HOST_OS STREQUAL "tvos")
197197
# control cross-compiling to ios
198198
add_definitions(-D_THREAD_SAFE)
199199
set(HOST_DARWIN 1)
200-
set(HOST_IOS 1)
201-
if(CLR_CMAKE_HOST_OS STREQUAL "tvos")
200+
if(CLR_CMAKE_HOST_OS STREQUAL "ios")
201+
set(HOST_IOS 1)
202+
elseif(CLR_CMAKE_HOST_OS STREQUAL "tvos")
202203
set(HOST_TVOS 1)
203204
endif()
204205
set(PTHREAD_POINTER_ID 1)
@@ -318,12 +319,13 @@ if(TARGET_SYSTEM_NAME STREQUAL "darwin")
318319
elseif(TARGET_SYSTEM_NAME STREQUAL "ios" OR TARGET_SYSTEM_NAME STREQUAL "tvos")
319320
set(TARGET_UNIX 1)
320321
set(TARGET_MACH 1)
321-
set(TARGET_IOS 1)
322322
set(TARGET_DARWIN 1)
323-
if(TARGET_SYSTEM_NAME STREQUAL "tvos")
323+
set(TARGET_APPLE_MOBILE 1)
324+
if(TARGET_SYSTEM_NAME STREQUAL "ios")
325+
set(TARGET_IOS 1)
326+
elseif(TARGET_SYSTEM_NAME STREQUAL "tvos")
324327
set(TARGET_TVOS 1)
325328
endif()
326-
set(TARGET_APPLE_MOBILE 1)
327329
elseif(TARGET_SYSTEM_NAME STREQUAL "linux")
328330
set(TARGET_UNIX 1)
329331
set(TARGET_LINUX 1)
@@ -729,7 +731,7 @@ elseif(HOST_BROWSER)
729731
set(HAVE_SYS_ICU 1)
730732
set(STATIC_ICU 1)
731733
set(ICU_LIBS "icucore")
732-
elseif(HOST_IOS OR HOST_MACCAT)
734+
elseif(HOST_IOS OR HOST_TVOS OR HOST_MACCAT)
733735
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")
734736
set(HAVE_SYS_ICU 1)
735737
set(STATIC_ICU 1)
@@ -934,7 +936,7 @@ set(FULL_VERSION ${product_version_string})
934936
######################################
935937
# OS SPECIFIC CHECKS
936938
######################################
937-
if(HOST_IOS OR HOST_ANDROID OR HOST_MACCAT)
939+
if(HOST_IOS OR HOST_TVOS OR HOST_ANDROID OR HOST_MACCAT)
938940
# FIXME: the mobile products use mono_dllmap_insert so allow this
939941
unset(DISABLE_DLLMAP)
940942
else()
@@ -958,7 +960,7 @@ endif()
958960
add_subdirectory("${CLR_SRC_NATIVE_DIR}/public" public_apis)
959961

960962
add_subdirectory(mono)
961-
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)
963+
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)
962964
add_subdirectory(dlls/mscordbi)
963965
endif()
964966

src/mono/cmake/configure.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ endif()
9999

100100
check_include_files("sys/types.h;sys/user.h" HAVE_SYS_USER_H)
101101

102-
if(HOST_IOS OR HOST_MACCAT)
102+
if(HOST_IOS OR HOST_TVOS OR HOST_MACCAT)
103103
# getentropy isn't allowed in the AppStore: https://github.com/rust-lang/rust/issues/102643
104104
set(HAVE_GETENTROPY 0)
105105
endif()
@@ -247,7 +247,7 @@ if(HOST_WIN32)
247247
set(HAVE_STRUCT_SOCKADDR_IN6 1)
248248
set(HAVE_STRTOK_R 1)
249249
set(HAVE_EXECVP 0)
250-
elseif(HOST_IOS)
250+
elseif(HOST_IOS OR HOST_TVOS)
251251
set(HAVE_SYSTEM 0)
252252
set(HAVE_SYS_USER_H 0)
253253
if(HOST_TVOS)

src/mono/mono/component/debugger-agent.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@
110110
#endif
111111

112112
/*
113-
* On iOS we can't use System.Environment.Exit () as it will do the wrong
113+
* On iOS/tvOS we can't use System.Environment.Exit () as it will do the wrong
114114
* shutdown sequence.
115115
*/
116-
#if !defined (TARGET_IOS)
116+
#if !defined (TARGET_IOS) && !defined(TARGET_TVOS)
117117
#define TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT
118118
#endif
119119

src/mono/mono/metadata/exception.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ mono_invoke_unhandled_exception_hook (MonoObject *exc)
12531253
}
12541254
mono_runtime_printf_err ("[ERROR] FATAL UNHANDLED EXCEPTION: %s", msg);
12551255
g_free (msg);
1256-
#if defined(HOST_IOS)
1256+
#if defined(HOST_IOS) || defined(HOST_TVOS)
12571257
g_assertion_message ("Terminating runtime due to unhandled exception");
12581258
#else
12591259
exit (mono_environment_exitcode_get ());

src/mono/mono/mini/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if(HOST_DARWIN)
1919
if(CMAKE_SYSTEM_VARIANT STREQUAL "maccatalyst")
2020
set(OS_LIBS ${OS_LIBS} "-lobjc" "-lc++")
2121
endif()
22-
elseif(HOST_IOS)
22+
elseif(HOST_IOS OR HOST_TVOS)
2323
set(OS_LIBS "-framework CoreFoundation" "-lobjc" "-lc++")
2424
elseif(HOST_ANDROID)
2525
set(OS_LIBS m dl log)

src/mono/mono/mini/dwarfwriter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static int subprogram_attr [] = {
455455
DW_AT_MIPS_linkage_name, DW_FORM_string,
456456
DW_AT_decl_file , DW_FORM_udata,
457457
DW_AT_decl_line , DW_FORM_udata,
458-
#ifndef TARGET_IOS
458+
#if !defined (TARGET_IOS) && !defined(TARGET_TVOS)
459459
DW_AT_description , DW_FORM_string,
460460
#endif
461461
DW_AT_low_pc , DW_FORM_addr,
@@ -1828,7 +1828,7 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod
18281828
emit_uleb128 (w, 0);
18291829
emit_uleb128 (w, 0);
18301830
}
1831-
#ifndef TARGET_IOS
1831+
#if !defined (TARGET_IOS) && !defined(TARGET_TVOS)
18321832
emit_string (w, name);
18331833
#endif
18341834
g_free (name);

src/mono/mono/mini/exceptions-arm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ mono_arch_unwind_frame (MonoJitTlsData *jit_tls,
491491

492492
for (i = 0; i < 16; ++i)
493493
regs [i] = new_ctx->regs [i];
494-
#ifdef TARGET_IOS
494+
#if defined (TARGET_IOS) || defined(TARGET_TVOS)
495495
/* On IOS, d8..d15 are callee saved. They are mapped to 8..15 in unwind.c */
496496
for (i = 0; i < 8; ++i)
497497
regs [MONO_MAX_IREGS + i] = *(guint64*)&(new_ctx->fregs [8 + i]);
@@ -509,7 +509,7 @@ mono_arch_unwind_frame (MonoJitTlsData *jit_tls,
509509
new_ctx->regs [i] = regs [i];
510510
new_ctx->pc = regs [ARMREG_LR];
511511
new_ctx->regs [ARMREG_SP] = (gsize)cfa;
512-
#ifdef TARGET_IOS
512+
#if defined (TARGET_IOS) || defined(TARGET_TVOS)
513513
for (i = 0; i < 8; ++i)
514514
new_ctx->fregs [8 + i] = *(double*)&(regs [MONO_MAX_IREGS + i]);
515515
#endif

src/mono/mono/mini/mini-arm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ mono_arch_init (void)
827827
#else
828828
arm_fpu = MONO_ARM_FPU_VFP;
829829

830-
#if defined(ARM_FPU_NONE) && !defined(TARGET_IOS)
830+
#if defined(ARM_FPU_NONE) && !defined(TARGET_IOS) && !defined(TARGET_TVOS)
831831
/*
832832
* If we're compiling with a soft float fallback and it
833833
* turns out that no VFP unit is available, we need to
@@ -870,7 +870,7 @@ mono_arch_init (void)
870870
v7_supported = TRUE;
871871
#endif
872872

873-
#if defined(TARGET_IOS)
873+
#if defined(TARGET_IOS) || defined(TARGET_TVOS)
874874
/* iOS is special-cased here because we don't yet
875875
have a way to properly detect CPU features on it. */
876876
thumb_supported = TRUE;

src/mono/mono/mini/mini-arm64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ mono_arch_cpu_init (void)
367367
void
368368
mono_arch_init (void)
369369
{
370-
#if defined(TARGET_IOS) || defined(TARGET_WATCHOS) || defined(TARGET_OSX)
370+
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_WATCHOS) || defined(TARGET_OSX)
371371
ios_abi = TRUE;
372372
#endif
373373
#ifdef MONO_ARCH_ENABLE_PTRAUTH
@@ -1097,7 +1097,7 @@ mono_arm_emit_aotconst (gpointer ji, guint8 *code, guint8 *code_start, int dreg,
10971097
gboolean
10981098
mono_arch_have_fast_tls (void)
10991099
{
1100-
#ifdef TARGET_IOS
1100+
#if defined(TARGET_IOS) || defined(TARGET_TVOS)
11011101
return FALSE;
11021102
#else
11031103
return TRUE;

src/mono/mono/mini/mini-arm64.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ typedef struct {
186186
// can pass context to generics or interfaces?
187187
#define MONO_ARCH_HAVE_VOLATILE_NON_PARAM_REGISTER 1
188188

189-
#ifdef TARGET_IOS
189+
#if defined(TARGET_IOS) || defined(TARGET_TVOS)
190190

191191
#define MONO_ARCH_REDZONE_SIZE 128
192192

@@ -196,7 +196,7 @@ typedef struct {
196196

197197
#endif
198198

199-
#if defined(TARGET_IOS) || defined(TARGET_WATCHOS)
199+
#if defined(TARGET_IOS) || defined(TARGET_TVOS) || defined(TARGET_WATCHOS)
200200
#define MONO_ARCH_HAVE_UNWIND_BACKTRACE 1
201201
#endif
202202

0 commit comments

Comments
 (0)