fix(relinker): read guest TLS relocations against the module's own section symbol #9429
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9429"
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-21T21:50:59Z.
What
Split out of #6977 as asked there; part of the PS4 Limbo work tracked in #6978.
The bundled
libSceFios2.prxof Limbo (CUSA01664) and of Bloodborne (CUSA00900) has DTPMOD64 relocations against a local section symbol with section index 0 and value 0, and the modules carry no section headers (e_shnum0). As for a TLS relocation without a symbol, the module and offset are the module's own TLS block, soGuestImageReaderpasses a DTPMOD64 or DTPOFF64 against such a symbol on without the symbol.The accepted form is narrow: a local
STT_SECTIONsymbol with section index 0 and value 0, in a module withPT_TLS. A section symbol that names a section (there is no section table in these modules to show that section is TLS) or has a value, a TPOFF64, a module withoutPT_TLSand a DTPMOD64 with an addend still fail withInvalid guest TLS relocation.Tested
Windows 11, WinLibs GCC 15.2, relinker on
maincecb540a6:guest_own_tls_relocations: DTPMOD64 and DTPOFF64 against the own section symbol convert for Linux, Windows and macOS output (the Linux output keeps the relocation without the symbol), for plain and SCE modules; the refused forms above fail. Withmain'sGuestImageReader.cppthe test fails withInvalid guest TLS relocation.--windows; onmainalone both stop inlibSceFios2.prxwithInvalid guest TLS relocation.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-21T22:29:04Z.
Review: COMMENTED
Validated on Apple Silicon, both native arm64 and x86_64 under Rosetta 2.
6f3e4a147, on top of maina6dcea9279.-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON). x86_64 build with-DCMAKE_OSX_ARCHITECTURES=x86_64 -DPython3_EXECUTABLE=/usr/bin/python3(Python 3.9.6), so the Python harness and the relinker run under Rosetta.Results:
guest_own_tls_relocationspasses on both arches; it exercises the--macosoutput path alongside Linux and--windows, so the new DTPMOD64/DTPOFF64 own-TLS-block handling is covered for the Mach-O guest layout too.Red/green on arm64: reverting only
GuestImageReader.cppto main while keeping the new test makes it fail at the first case withFAIL: ... Invalid guest TLS relocation; the full merge turns it green. So the test guards the regression.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-21T22:39:13Z.
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/CMakeLists.txt