Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2022-09-30 17:11:13 +0300
committerGitHub <noreply@github.com>2022-09-30 17:11:13 +0300
commitd6f4ee110dde598759ea12222d4fd2db8ea00f80 (patch)
tree50cad6eac642e46505c65c4cf94d68598c0d1eea /src
parentac8ed2945e5ac0df7e0f42afd10c819dec0b166a (diff)
[mono] Fix iOS/tvOS build with Xcode 14 (#76433)
Before Xcode 14 the `objc_super` struct definition in the SDK headers looked like this: ``` #if !defined(__cplusplus) && !__OBJC2__ /* For compatibility with old objc-runtime.h header */ __unsafe_unretained _Nonnull Class class; #else __unsafe_unretained _Nonnull Class super_class; #endif ``` With Xcode 14 however the iOS/tvOS SDK header was changed to only define `super_class`, but the MacOSX SDK stayed the same. Added CMake detection of this case so we can compile both on older and newer Xcode SDKs across platforms.
Diffstat (limited to 'src')
-rw-r--r--src/mono/cmake/config.h.in3
-rw-r--r--src/mono/cmake/configure.cmake4
-rw-r--r--src/mono/mono/utils/mono-threads-mach-helper.c6
3 files changed, 10 insertions, 3 deletions
diff --git a/src/mono/cmake/config.h.in b/src/mono/cmake/config.h.in
index 4ac722c9d92..71753f1d47e 100644
--- a/src/mono/cmake/config.h.in
+++ b/src/mono/cmake/config.h.in
@@ -612,6 +612,9 @@
/* Define to 1 if `st_atimespec' is a member of `struct stat'. */
#cmakedefine HAVE_STRUCT_STAT_ST_ATIMESPEC 1
+/* Define to 1 if `super_class' is a member of `struct objc_super'. */
+#cmakedefine HAVE_OBJC_SUPER_SUPER_CLASS 1
+
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1
diff --git a/src/mono/cmake/configure.cmake b/src/mono/cmake/configure.cmake
index 51cb315d6dc..ae55fd112b3 100644
--- a/src/mono/cmake/configure.cmake
+++ b/src/mono/cmake/configure.cmake
@@ -129,6 +129,10 @@ check_struct_has_member("struct sockaddr_in6" sin6_len "netinet/in.h" HAVE_SOCKA
check_struct_has_member("struct stat" st_atim "sys/types.h;sys/stat.h;unistd.h" HAVE_STRUCT_STAT_ST_ATIM)
check_struct_has_member("struct stat" st_atimespec "sys/types.h;sys/stat.h;unistd.h" HAVE_STRUCT_STAT_ST_ATIMESPEC)
+if (HOST_DARWIN)
+ check_struct_has_member("struct objc_super" super_class "objc/runtime.h;objc/message.h" HAVE_OBJC_SUPER_SUPER_CLASS)
+endif()
+
check_type_size("int" SIZEOF_INT)
check_type_size("void*" SIZEOF_VOID_P)
check_type_size("long" SIZEOF_LONG)
diff --git a/src/mono/mono/utils/mono-threads-mach-helper.c b/src/mono/mono/utils/mono-threads-mach-helper.c
index 0efe506faf5..64b49ceabef 100644
--- a/src/mono/mono/utils/mono-threads-mach-helper.c
+++ b/src/mono/mono/utils/mono-threads-mach-helper.c
@@ -59,10 +59,10 @@ mono_dead_letter_dealloc (id self, SEL _cmd)
{
struct objc_super super;
super.receiver = self;
-#if !defined(__cplusplus) && !__OBJC2__
- super.class = nsobject;
-#else
+#if defined(__cplusplus) || defined(HAVE_OBJC_SUPER_SUPER_CLASS)
super.super_class = nsobject;
+#else
+ super.class = nsobject;
#endif
void (*objc_msgSendSuper_op)(struct objc_super *, SEL) = (void (*)(struct objc_super *, SEL)) objc_msgSendSuper;
objc_msgSendSuper_op (&super, dealloc);