fix(relinker): stop module syscall scans at the PLT and skip the PS4 loader path #5994
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5994"
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 Get-fix on 2026-10-14T18:37:07Z.
What
OpenOrbis modules (
sce_module/*.prx) stop in the relinker at two places after #5138, which makes their section-symbol relocations convertible. Both are about where a module's code is, so they are one change.sce_modulemodules decoded that data, and the library sample'slibExample.prxfailed withFAIL: Forbidden syscall instruction at code offset 0xd016e. For modules with aPT_SCE_DYNLIBDATAsegment, the scan now stops at the end of the PLT after the last unwind function, found byFindSceCodeEndas for executables (#5195)./libexec/ld-elf.so.1string but have noPT_INTERPheader, so code analysis decoded the string and failed withFAIL: Unsupported Windows guest TLS instruction (bytes: 64 2d 65 6c 66 2e) (offset 0x400a), which is the textd-elf.. When noPT_INTERPcovers the start of a PS4 code segment and the segment begins with exactly that string, code analysis starts after it.The relinker debt file records that code after the PLT is not scanned. Part of the PS4 homebrew work tracked in #3093.
Tested
Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, on
maine442f4c2e:sce_module_code_extenttest builds two modules: one whose text starts with the loader path and has noPT_INTERP, and one with data after the code. Both fail onmainand pass with this change. Reverting either part makes it fail.main.using_librarywith #5138 merged:mainwith #5138 stops at the syscall scan; with this change and without the loader-path part, it stops at the TLS instruction above. With both, the program converts, starts and calls into the module (onmaine442f4c2ewith the other changes listed in #3093):test string: Hi I'm from the library! You passed: 13371338 | rv = 0x00000000.tools/check_conventions.py --base origin/mainpasses.Not tested on Linux or macOS.
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)using_librarysample also needs #5138using_library), #3093🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T20:06:00Z.
Review: COMMENTED
macOS data point: the
--macostarget hits the same loader-path failure, and this PR fixes it there too.Apple M2 Max, macOS 27.2 (26B5091g), AppleClang, Ninja Release, relinker-only. Head
8997cac1bmerged without conflicts intomainc26982f63.-DCMAKE_OSX_ARCHITECTURES=x86_64, Python 3.9.6): 160/164; the 4 failures (pr_overlap_encoding,stubgen_stdout_newlines,release_package,linux_fixed_base) fail the same way on unmodifiedmainhere.sce_module_code_extentwith only the test applied onmainfails on both builds withUnsupported Windows guest TLS instruction (bytes: 64 2d 65 6c 66 2e) (offset 0x100a); with the PR it passes.The test converts both fixtures with
--windowsonly. I ran the same two fixtures (fixture(rodata_address=False, interp_header=False)andsce_module()from the test) through every target, same results on the arm64 and x86_64 binaries:mainPT_INTERPForbidden syscall instruction at code offset 0x1020--macosPT_INTERPUnsupported macOS guest TLS instruction (bytes: 64 2d 65 6c 66 2e) (offset 0x100a)--macosForbidden syscall instruction at code offset 0x1020--windowsPT_INTERPUnsupported Windows guest TLS instruction ...--windowsForbidden syscall instruction at code offset 0x1020So the syscall-scan part matters on all three targets and the loader-path part on macOS and Windows; this covers conversion on the Linux and macOS hosts the description lists as untested. Running the fixtures with
--macosas well would keep the macOS TLS path under test.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T11:13:33Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/relinker/relinker/src/guest/GuestModuleBuilder.cppL330-331docs/dev/debt/relinker.mdL17core/relinker/relinker/tests/test_sce_module_code_extent.pySome 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/CMakeLists.txtcore/relinker/relinker/src/guest/GuestModuleBuilder.cppcore/relinker/CMakeLists.txtdocs/dev/debt/relinker.mdcore/relinker/CMakeLists.txtdocs/dev/debt/relinker.mdcore/relinker/CMakeLists.txtImported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T13:35:15Z.
@jotitadev Thanks for running it on macOS. I followed your suggestion: Get-fix/AnyPS5@f7ec358ec converts both fixtures for Linux, Windows and macOS.
I checked each target without each part of the fix, using
--macosconversions run on Windows. The results match your table:Unsupported … guest TLS instruction (bytes: 64 2d 65 6c 66 2e) (offset 0x100a), and Linux converts.The relinker-only ctest passes (165/165).
I checked the overlap the bot lists. I fetched each listed pull request and, for every file it shares with this one, merged its change with
git merge-fileinto currentmain(a5e2a80c6) and intomainwith this pull request merged. A conflict that appears only in the second case is one this pull request adds.The bot lists 24 pull requests, with 45 shared files between them. This pull request adds a conflict in three:
FindSceCodeEnd, which this pull request calls for the module syscall scan, so the two fit together: modules whose PLT comes first get the same limit. The code merges cleanly; only the shared sentence indocs/dev/debt/relinker.mdneeds both edits.mainincore/relinker/CMakeLists.txt; thesce_module_code_extentregistration needs its style.Combined build: I built
mainwith this pull request, #6354, #6314 and #5138 merged.sce_code_extent(#6354) andsce_module_code_extentpass.relinker_game_patchandgame_patches, fail the same way withmainand #6314 alone on Windows: the expected manifest paths use the other slash.using_librarysample converts with its module.AI-assisted: yes (Claude Code). I ran these checks myself on Windows 11.
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:35:21Z.
Checked on the head merged onto current main: relinker-scope build and ctest (137 tests) pass, and
sce_module_code_extentfails when the two code changes are reverted. Relinker CI jobs are green on Linux, Windows and macOS, and @jotitadev's macOS run agrees. Merging once the full Build is green.