fix(relinker): move a neighbour without an FS or GS prefix with a 256-bit store first #7309
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7309"
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?
Imported from boykopovar/AnyPS5. Originally posted by morten-holm on 2026-10-17T22:40:57Z.
What
A 256-bit store (
vmovups ymm) is 4 bytes long. The jump to its stub needs 5 bytes, so the stub window takes a neighbouring instruction.The window took the following instruction first. In PPSA21567 that instruction is the thread-pointer read
mov rax, fs:0. The macOS writer cannot rewrite a TLS access inside a stub, so it refuses the module:The window now tries a neighbour without an FS or GS prefix first, the following one and then the preceding one. It uses the old order only when no such neighbour fits. Output does not change where the access can stay in the stub.
Tested
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON) onmainb4f05ab32: 178 of 178 tests pass.check_conventions.pypasses.converterWideStoreWindowsfail when the fix is reverted. They cover an FS read and a GS read after the store, and the fallback when the store has no other neighbour.relinker --macos --to-rosettaon PPSA21567: without the fix it stops with the error above. With the fix it relinks (164,493 stubs, 1 module converted).mov rax, fs:0) becomes an 8-byte window that starts 4 bytes earlier. The other 164,490 sites are identical.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 (none added).mdfiles or images added to the repository🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T22:55:14Z.
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.
core/relinker/codegen/tests/Amd64OnlyConverterTests.cppcore/relinker/codegen/tests/Amd64OnlyConverterTests.cpp