From 0dd81064022d8b5a86160922d2f615f9e41a25a0 Mon Sep 17 00:00:00 2001 From: Sev Date: Mon, 21 Sep 2026 11:26:47 +0700 Subject: [PATCH] osdlib_retro: flush the instruction cache on macOS invalidate_instruction_cache skipped the flush under !defined(TARGET_OS_IPHONE). Apple's TargetConditionals.h DEFINES TARGET_OS_IPHONE as 0 on macOS, so the guard was false there and Apple Silicon ran stale code in recompiler output: the first hng64 build died with SIGILL on a valid instruction (movz x14,#0x4f10). Test the macro's value, not its presence. Control: the unpatched build crashes on the same run; patched, sams64 and xrally run 1800 frames with the same distinct-frame counts as the buildbot's full core. --- src/osd/modules/lib/osdlib_retro.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/modules/lib/osdlib_retro.cpp b/src/osd/modules/lib/osdlib_retro.cpp index 3dd84de33f32e..7c208e5aeb995 100644 --- a/src/osd/modules/lib/osdlib_retro.cpp +++ b/src/osd/modules/lib/osdlib_retro.cpp @@ -324,7 +324,7 @@ bool invalidate_instruction_cache(void const *start, std::size_t size) noexcept #if defined(_WIN32) return FlushInstructionCache(GetCurrentProcess(), start, size) != 0; #else -#if !defined(SDLMAME_EMSCRIPTEN) && !defined(TARGET_OS_IPHONE) +#if !defined(SDLMAME_EMSCRIPTEN) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) char const *const begin(reinterpret_cast(start)); char const *const end(begin + size); __builtin___clear_cache(const_cast(begin), const_cast(end));