Skip to content

Commit 2f7d584

Browse files
committed
Fix build on macOS 13 / Xcode 14 (#21597)
Fixes #21567 (cherry picked from commit fc185ee)
1 parent 03b0996 commit 2f7d584

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

configure.ac

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,12 @@ if test x$host_win32 = xno; then
33083308
dnl ******************************************
33093309
AC_CHECK_HEADERS(CommonCrypto/CommonDigest.h)
33103310

3311+
AC_CHECK_MEMBER(struct objc_super.super_class,
3312+
[AC_DEFINE(HAVE_OBJC_SUPER_SUPER_CLASS, 1, [struct objc_super.super_class])],
3313+
[],
3314+
[#include <objc/runtime.h>
3315+
#include <objc/message.h>])
3316+
33113317
dnl *********************************
33123318
dnl *** Check for Console 2.0 I/O ***
33133319
dnl *********************************

mono/metadata/w32process-unix-osx.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,22 @@ mono_dyld_image_info_free (void *info)
183183
static void
184184
image_added (const struct mach_header *hdr32, intptr_t vmaddr_slide)
185185
{
186+
#if defined(__APPLE__) && defined(__clang__) // getsectbynamefromheader functions are deprecated as of macOS 13.0
187+
#pragma clang diagnostic push
188+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
189+
#endif
190+
186191
#if SIZEOF_VOID_P == 8
187192
const struct mach_header_64 *hdr64 = (const struct mach_header_64 *)hdr32;
188193
const struct section_64 *sec = getsectbynamefromheader_64 (hdr64, SEG_DATA, SECT_DATA);
189194
#else
190195
const struct section *sec = getsectbynamefromheader (hdr32, SEG_DATA, SECT_DATA);
191196
#endif
197+
198+
#if defined(__APPLE__) && defined(__clang__)
199+
#pragma clang diagnostic pop
200+
#endif
201+
192202
Dl_info dlinfo;
193203
if (!dladdr (hdr32, &dlinfo)) return;
194204
if (sec == NULL) return;

mono/utils/mono-threads-mach-helper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ mono_dead_letter_dealloc (id self, SEL _cmd)
5959
{
6060
struct objc_super super;
6161
super.receiver = self;
62-
#if !defined(__cplusplus) && !__OBJC2__
63-
super.class = nsobject;
64-
#else
62+
#if defined(__cplusplus) || defined(HAVE_OBJC_SUPER_SUPER_CLASS)
6563
super.super_class = nsobject;
64+
#else
65+
super.class = nsobject;
6666
#endif
6767
void (*objc_msgSendSuper_op)(struct objc_super *, SEL) = (void (*)(struct objc_super *, SEL)) objc_msgSendSuper;
6868
objc_msgSendSuper_op (&super, dealloc);

0 commit comments

Comments
 (0)