The guest image reader and the module builder already produce a platform-neutral GuestImage; --macos adds a third writer next to the ELF and PE ones. The executable and every bundled module become x86-64 Mach-O files (modules as dylibs in app0/sce_module) that run under Rosetta on Apple silicon. FreeBSD code reaches its thread pointer through %fs, which macOS cannot set, so the writer rewrites each %fs access into a stub that reads the image's thread pointer from a pthread key and allocates the TLS block on a thread's first access. Dynamic TLS goes through the image's descriptor instead of __tls_get_addr. Imports bind by NID to the prx libraries beside the output, exports and TLS imports use the dynamic symbol names, and the image's metadata lives in __APS5DATA,__meta. --macos conflicts with --windows. The macOS runtime that consumes the output (TLS allocation, libraries built for macOS) comes in separate changes. |
||
|---|---|---|
| .. | ||
| include | ||
| src | ||
| tests | ||