mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:00:52 +01:00
[PR #1174] x64_recomp: native JIT-free arm64 Mach-O userland runner for Apple Silicon (X64-RECOMP-MACHO-RUNNER) #1207
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1207
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1174
Author: @IlyassRS3
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:feat/x64-recomp-darwin-macho-runner📝 Commits (1)
ad64b4fx64_recomp: native JIT-free arm64 Mach-O userland runner for Apple Silicon (X64-RECOMP-MACHO-RUNNER)📊 Changes
3 files changed (+812 additions, -57 deletions)
View changed files
📝
docs/mobile.md(+29 -6)📝
tests/test_x64_recomp.py(+309 -25)📝
tools/x64_recomp.py(+474 -26)📄 Description
Claimed in the coordination issue as: X64-RECOMP-MACHO-RUNNER (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142321014)
What and why
Implements Next Step #4 of
docs/mobile.md: a pure-Python, JIT-free arm64 Mach-O +mmapuserland runner intools/x64_recomp.pyso translated x86-64 functions run natively on Apple Silicon macOS (including themacos-26CI runner) withoutqemu-system-aarch64,clang,codesign, orMAP_JIT.pack_macho_arm64wraps PIE arm64 code in a 64-bitMH_EXECUTE(MH_PIE, 4 GiB__PAGEZERO, 16 KiB-aligned__TEXT/__LINKEDIT) with a pure-Python ad-hoc SHA-256LC_CODE_SIGNATURE(CodeDirectoryv0x20400,CS_ADHOC | CS_LINKER_SIGNED, validated bycodesign -vvv).emit_rt(..., darwin=True)usesAsm.adr+ signed 64-bitpc_tableoffsets socall/retand indirect jumps work under any ASLR slide.build_test_macho/run_macho/run_macho_resultmap guest RW memory at0x10047000000(MAP_PRIVATE | MAP_ANON, noMAP_FIXED, clean exit 77 on collision), zero guest GPRs andNZCV, and supportmap_code=True(read-only mapped guest code for RIP-relative reads).tests/test_x64_recomp.pyruns all 26 existingExecTestsnatively on Apple Silicon plus 6 cross-platformMachOBuilderTestsand 8MachONativeTests. Verified clean againstmainand zero conflicts with openx64_recompPRs (#847, #950, #1120, #1121).Tested
python3 -I tests/test_x64_recomp.py -von Apple M5 / macOS 27.2.1 (Python 3.14): 46/46 passed (5 consecutive runs, 0 failures), includingcodesign -vvv, RIP-relative reads, multi-page signed images, and PIE indirect dispatch across ASLR runs.python3 -m compileall -q make_game.py tools testsandpython3 -I make_game.py --help: clean.python3 -I scripts/check_no_game_data.py tools/x64_recomp.py tests/test_x64_recomp.py docs/mobile.md: clean.tests/test_recomp_census.py,tests/test_report_paths.py,tests/test_text_write_line_endings.py,tests/test_ci_registration.py,tests/test_tool_startup.py, and alltests/test_docs_*.py: all passed.GPUs tested: n/a (CPU x86-64 -> arm64 recompiler; tested natively on Apple M5 arm64, macOS 27.2.1)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.