From 0838142abd4c1cb2771b5721c18a90eb75777305 Mon Sep 17 00:00:00 2001 From: Stepz97 <128724105+Stepz97@users.noreply.github.com> Date: Sun, 2 Aug 2026 02:27:32 +0200 Subject: [PATCH] macOS: anchor the guest address space in full-emulator test targets (#143) fix(cmake): anchor the macOS guest address space for all full-emulator tests Every target created by add_kyty_full_emulator_test links against the full kyty_emulator sources, so it drags in the same 620 GiB .zerofill guest address space segments as the emulator itself. Only the emulator target and virtual_memory_allocation_tests had the linker flags that anchor those segments; every other full-emulator test target got the segments without the anchoring, and the kernel killed them on exec (posix_spawn EIO / SIGKILL) before main() ever ran. Move the configure_macos_guest_address_space() call into add_kyty_full_emulator_test() itself so every target it creates gets it automatically, and drop the now-redundant explicit call on virtual_memory_allocation_tests. --- src/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9a135ef4f..530830d32 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -312,6 +312,9 @@ function(add_kyty_full_emulator_test target source) target_link_libraries(${target} onecore) add_custom_command(TARGET ${target} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "${KYTY_THIRD_PARTY_DIR}/winpthread/bin/libwinpthread-1.dll" $/libwinpthread-1.dll) endif() + # The macOS x86_64 guest address space needs its .zerofill segments anchored + # by linker flags, or the kernel kills the binary on load (posix_spawn EIO). + configure_macos_guest_address_space(${target}) endfunction() function(configure_macos_guest_address_space target) @@ -431,7 +434,6 @@ target_sources(shader_recompiler_compute_tests PRIVATE add_kyty_full_emulator_test(virtual_memory_allocation_tests ../tests/VirtualMemoryAllocationTests.cpp) target_compile_definitions(virtual_memory_allocation_tests PRIVATE KYTY_VIRTUAL_MEMORY_ALLOCATION_TESTS=1) -configure_macos_guest_address_space(virtual_memory_allocation_tests) # These tests use exceptions. if(NOT KYTY_CLANG_CL)