fix(relinker): keep the interpreter path out of the scanned code #8599
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8599"
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 javierUDP on 2026-10-20T17:59:17Z.
Reopens #7996, which closed when I republished its branch to rebase it. Same two commits, rebased onto current
mainas @oneandonlydean asked, with the conflict inCodeInstructionCollector.cppresolved to keep both rules.What
The code analysis trims an interpreter path from the start of an executable segment only for images that have a
PT_SCE_DYNLIBDATAblock. An executable without one keeps that path in the scanned range./libexec/ld-elf.so.1then gets walked as code: aR_X86_64_RELATIVErelocation with addend 0 roots the control flow graph at the first byte of the segment, and the0x64ofld-elfdecodes as an FS-prefixed instruction, which the Windows and macOS TLS rewriters refuse:Linux output is unaffected because it keeps the guest
%fsaccesses. The trim now runs for both layouts, ending at the segment for an image without the block, and it takes an interpreter only when it starts the segment, so an interpreter that follows the code leaves the code in front of it alone. This is thePT_INTERPitem of the remaining PS4 work in #3093.The rebase keeps
sceFunctionsand the merged unwind ranges that #8166 added, and the SCE path still takes any interpreter inside the scanned range, as it did before this change.Tested
Apple M5, macOS 26.4, AppleClang 21.0.0, relinker-only build, after the rebase onto
main:samples-elf-llvm-18.zip, v0.5.3) convert with--windows; onmainthey are refused with the message above. The 3 modules convert as before.PT_INTERPfollows the code converts (rc 0), as it does onmain.interpreter_in_codecovers three images: interpreter at the segment start, no interpreter, and interpreter after the code.python3 tools/check_conventions.py --base origin/mainpasses.On the previous head, @wachi35676 also ran Windows 11 and WSL (214/214 and 219/219) and checked that 4 PS5 homebrew titles relink byte-identically to
mainwith--to-inteland--to-rosetta. Those runs predate this rebase.No Linux or Windows host was available here.
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: n/a.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T18:15:27Z.
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/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/CMakeLists.txtcore/relinker/relinker/src/analysis/CodeInstructionCollector.cppcore/relinker/CMakeLists.txtcore/relinker/relinker/src/analysis/CodeInstructionCollector.cppcore/relinker/relinker/src/analysis/CodeInstructionCollector.cpp