Repository navigation
fix(relinker): skip prefixed decodings inside an earlier instruction in the macOS TLS scan - #6410
Merged
adriadam10 merged 3 commits intoOct 18, 2026
Conversation
…in the macOS TLS scan A function range that begins inside an instruction makes the code analysis collect a second decoding from the middle of it. The Windows TLS rewriter skips a non-FS segment-prefixed decoding there (90dcd62); the macOS scan did not, and refused the module. OpenSSL's assembly keeps its "CRYPTOGAMS by <appro@openssl.org>" string in the code segment, where the "en" of "openssl" decodes as a GS-prefixed instruction, so 24 catalog titles could not be converted for macOS: "Unsupported macOS guest TLS instruction (bytes: 65 6e)". The scan now skips such decodings as the Windows rewriter does.
…for macOS macos_tls_overlap converts the Windows coverage group's function-begins-inside-instruction fixture with --macos: a symbol starts inside a movabs whose immediate holds a GS-prefixed decoding. It converts, and the movabs is unchanged in the output.
… macOS Only a segment-prefixed decoding inside an earlier instruction is skipped; a GS load that begins an instruction is still refused.
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
This was referenced Oct 15, 2026
Merged
Contributor
Author
|
Hardware run on Apple silicon, as asked in the handoff. macOS 26.7.1, Apple M2 (8 GB), Rosetta 2, AppleClang 21.0.0. Relinkers built (
AI-assisted: yes |
11 tasks done
12 tasks done
12 tasks done
ycarogabriel-lgtm
added a commit
to ycarogabriel-lgtm/AnyPS5
that referenced
this pull request
Oct 19, 2026
The branch no longer merged cleanly with main, which jotitadev reported after rechecking 57bccfb on the M2 Max; this brings in 183 upstream commits, among them boykopovar#6410, boykopovar#6419 and boykopovar#6458, which this branch carried. Conflicts: - recompile request serialization: main moved to version 34 for pixel sample iteration and locations, this branch to 33 for the fragment barycentric built-ins flag. Both fields are kept and the version becomes 35; the barycentric flag is read from 35 on, so a version 34 request written by main still parses. The serializer tests, and main's new version 30 and 32 cases in ShaderMemory, account for the extra trailing byte. - ShaderInfoCollector: main folds the center and sample barycentric kinds into one input and adds gl_SampleID for sample iteration; the gl_FragCoord input that keeps Apple GPUs' barycentrics normalized is kept for all three kinds. - QuadSampleMasks keeps this branch's per-sample masks beside main's sample iteration fields; DynamicLoader keeps the macOS image field beside main's Windows load order; the relinker keeps its macOS fixture and fixed-base tests; the GS trap debt line is main's newer wording from boykopovar#6458. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
27 catalog titles cannot be converted for macOS on
main, among them SuperTuxKart (PPSA69421), PSXS5 (PPSA97510), SwanStationPS5 (PPSA98510), ProsperoStore (PPSA99000), ProsperoRadio (PPSA99001), ProsperoTV (PPSA99003), SymphonyStation5 (PPSA17641) and OpenNOW (PPSA99082). Each fails on the same two bytes:They are not code. The titles link OpenSSL, whose assembly keeps
CRYPTOGAMS by <appro@openssl.org>in the code segment; at PSXS5's offset 0xbabf4d the bytes are theenofopenssl(... 6f 70 | 65 6e 73 73 6c ...). A function range that begins inside an instruction makes the code analysis collect a second decoding from the middle of it, and here that decoding starts with a GS prefix. The Windows TLS rewriter skips a non-FS segment-prefixed decoding inside an earlier collected instruction (90dcd62, "tolerate unwind ranges that split an instruction"), so the same titles convert for Windows. The macOS scan inMacOsImage.cpphas no such check and refuses the module.The macOS scan now tracks the end of the decodings it has seen, as the Windows rewriter does, and skips a segment-prefixed decoding that starts inside an earlier one unless the prefix is FS. A GS access at an instruction start is still refused.
With this PR 25 of the 27 convert. The other two get past this refusal and stop on unrelated ones, each with its own PR: Mortalfin (PPSA99141) on
Guest TLS access without a non-empty PT_TLS(#6448) and PS5MC (PPSA99420) on the stack-protector checksub %fs:0x28,%rax(#6419).Three commits:
fix(relinker): skip prefixed decodings inside an earlier instruction in the macOS TLS scan.test(relinker): convert a function that begins inside an instruction for macOS: a newmacos_tls_overlaptest converts the Windows coverage group'sfunction-begins-inside-instructionfixture with--macos. A symbol starts inside amovabswhose immediate holds a GS-prefixed decoding (65 2e 62 69 6e). It converts, and themovabsis unchanged in the output.test(relinker): keep refusing a GS access at an instruction start for macOS.There is no fourth step to split out.
Tested
Windows host (be5dfd6 on
main0afa6a6, Windows 11 10.0.26300, WinLibs GCC 15.2.0 r7, Release). The relinker writes macOS output on any host:tools/check_conventions.py --base origin/main: passed.tools/pr_overlap.py: no overlap with open pull requests.Each of the three commits builds, and the relinker tests pass at each (
macos|tls_function_coverage|tls_diagnostics|guest_tls|empty_tls, 35/36/36 tests; run onmaind92a8da before rebasing onto 0afa6a6, which changes nothing undercore/relinker).macos_tls_overlapfails without the fix: withMacOsImage.cppas onmain,function-begins-inside-instructionstops withUnsupported macOS guest TLS instruction (bytes: 65 2e 62 69 6e c3 c3 c3).Full build and full
ctest: 1250/1258 passed. Seven of the eight failures were timeouts or crashes under load early in the run (guest_needed_modules,windows_diagnostic_fixture_isolation,guest_gnu_hash,guest_video_out_resolution_status,agc_shader_mode_register,guest_none_relocations,guest_avplayer); all seven pass when rerun alone. The eighth,check_main_sync, fails the same way onmainon this host: its Unicode file name test reads git's UTF-8 output as cp1252 (sp ace é.txt).Linux (WSL2 Ubuntu 24.04, GCC 13.3.0): the relinker builds and the
macos|tlstests pass (38/39;guest_force_tls_destructoris not run because only the relinker target was built).macOS conversion of every catalog title (79) with
main's relinker and with this branch's, same arguments:mainwith(bytes: 65 6e), converted with this PRmainwith(bytes: 65 6e), now stopping on a later, unrelated refusalThe bytes the refusal named stay in place. In 23 of the converted titles,
CRYPTOGAMS by <appro@openssl.org>occurs as often in the macOS output as in the input (20 times each); in the 24th, PPSA99039, the string is present in both input and output.macOS 26.7.1, Apple M2, MoltenVK 1.4.2, x86-64 under Rosetta, added 2026-10-16: head be5dfd6, converted with
--macos --to-rosettaand run 20 s each against the runtime of a local tree ofmainwith the macOS port work merged. 20 of the 25 titles were run, and each loads and runs its own code. Three keep running: PSXS5 (PPSA97510) draws its interface at about 11 ms a frame, SwanStationPS5 (PPSA98510) runs with only its network downloads failing (curl 77), and Nuvio PS5 (PPSA99997) is still running at 20 s. The other 17 run until the AGC driver stops on a GPU feature MoltenVK lacks:viewport depth outside [0, 1](feat(agc): remap a viewport depth range the device cannot express into the vertex shader #4650): PPSA17641, PPSA99001, PPSA99002, PPSA99003, PPSA99009, PPSA99773, PPSA99930;Barycentric geometry SPIR-V: geometry shaders are unavailable(Macos m4 #6222): PPSA74126, PPSA98427, PPSA99039, PPSA99082, PPSA99177, PPSA99474, PPSA99505, PPSA99515;last provoking vertex requires VK_EXT_provoking_vertex(fix(agc): draw a last provoking vertex that no pixel input sees without the extension #6741): PPSA99600.Not run there: SuperTuxKart (PPSA69421, 712 MB). PPSA99004, PPSA99008, PPSA99288 and PPSA99360 stopped on
Forbidden syscall instruction, since these runs didn't pass--skip-syscall-check.Limits of this Mac's GPU.
vulkaninfoon Apple M2 with MoltenVK 1.4.2 reports no geometry shaders, noshaderFloat64, noVK_EXT_depth_range_unrestrictedand noVK_EXT_provoking_vertex. AnyPS5 turns MoltenVK'sVK_KHR_fragment_shader_barycentricoff (5333a20), so barycentric pixel shaders need the geometry-shader fallback. These are limits of the device, so this PR can't remove them. A title named here as stopping on one of them is not tested past that stop:Barycentric geometry SPIR-V: geometry shaders are unavailable: no geometry shaders; Macos m4 #6222 has a route around it.viewport depth outside [0, 1] requires VK_EXT_depth_range_unrestricted: feat(agc): remap a viewport depth range the device cannot express into the vertex shader #4650 works around it.last provoking vertex requires VK_EXT_provoking_vertex: fix(agc): draw a last provoking vertex that no pixel input sees without the extension #6741 removes it only for draws whose pixel shader can't observe the provoking vertex.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)