fix(relinker): skip a dumper's backup copy of a module beside the module #7380
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7380"
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 thuanquang on 2026-10-18T03:44:48Z.
What
Some dumpers leave decrypted ELF copies next to each module, for example
libX.prx.esbakandlibX.prxbakbeside an ELFlibX.prx.ReadModulestakes every ELF file in a module directory, so each copy is converted as another module with the same SONAME, and the conversion stops inGuestModuleBuilder:Reports:
.prx,.prx.esbak,.prxbak); 29 files had to be moved out before the conversion ran.libc.prxconverts as an ELF module andlibc.prx.esbakbeside it stops the conversion the same way.After reading the modules,
ReadModulesnow skips a module as a backup copy when both of these hold:It prints which file it kept:
On
main, two modules with the same SONAME always stop the conversion with the error above, so this only changes layouts that fail today. Other cases are unchanged:libfoo.so.1andlibfoo.so.10, have different SONAMEs and are both converted..esbakbeside a SELF.prx(Demon's Souls #1946/#1973, the web converter's test froma22771965) is still the module that gets relinked.Not covered:
demo/web/archive.mjs,core/relinker/wasm/Bindings.cpp) passes its modules toGuestModuleBuilderwithoutReadModules, so it still stops on these layouts. Its test needs the wasm build, which I can't run here; it can follow in its own PR.libX.prxwith two ELF backups,libX.prx.esbakandlibX.prxbak, still stops: neither backup's name extends the other's. No report shows that layout.Overlap: #6231 rewrites the same line of
docs/user/USAGE.md(the module directory rules), so whichever of the two lands second has to merge the sentences.Tested
Windows 11 26200, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON:guest_module_directorieshas three new cases, each run for the Linux and Windows targets:libSceFace.prx,libSceFace.prx.esbakandlibSceFace.prxbak, all ELF with SONAMElibSceFace.prx: one output,libSceFace.prx.guest.prx, and one skip line for each copy. Onmainthis case exits 2 withFAIL: Ambiguous guest dependency name: libSceFace.prx.libfoo.so.1andlibfoo.so.10, each with its own SONAME: both convert and nothing is skipped, as onmain.libSceFace.prxwith an ELFlibSceFace.prx.esbak:libSceFace.prx.esbak.guest.prx, no skip line, as onmain.guest_module_directories,guest_module_dir,guest_module_identity,guest_needed_modules,guest_needed_nested_modules,input_preservation,windows_import_modules,relinker_executablesand the rest) pass.ctest --parallel 4 --timeout 120onmain1e2d9b369with this change: 1462 tests. The only failures are three AMD GPU tests that also fail without it on this machine:agc_driver_lds_mixed_width_atomics(#6976),agc_driver_lds_lock_budget(#7344) andagc_driver_layered_volume_vertex_no_gpl(#4768).relinkerjob ran the same tests on ubuntu-latest (g++), macos-latest (clang++, arm64 and x86_64), windows-latest (g++) and with ASan, and passed.python tools/check_conventions.py --base origin/mainwith this title and body passes.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 github-actions[bot] on 2026-10-18T03:59:40Z.
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)docs/user/USAGE.mdL11Some 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.
docs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mddocs/user/USAGE.mdImported from boykopovar/AnyPS5. Originally posted by simonbbby on 2026-10-18T04:23:29Z.
Independent boundary check of exact head
a7499e072f1e796e8d0172dcc76bc488174f4586on Ubuntu 24.04 x86-64, GCC 13.3, Release relinker-only. Generated ELF/module inputs only; no Furi/Dreaming Sarah assets or title execution.The stock
test_guest_module_directories.pypasses. An additional real-CLI matrix passes 46/46 conversions on this head, across Linux and Windows output targets:.prx+.prx.esbak+.prxbak: only the canonical module is emitted..prx+.prxbak+.prxbak.esbak: only the shortest/canonical module is emitted, even when a candidate prefix is itself a backup.sce_moduleandprx): still refuse withAmbiguous guest dependency name, with no output/app0 tree.DT_SONAME: both modules are emitted; neither is silently suppressed..prx.esbak/.prxbak) without the canonical file still refuse, matching the stated limitation.Creation order is permuted wherever there is more than one file. Every original executable/module hash remains unchanged through all controls.
To check that these assertions discriminate the guards, I rebuilt only the changed CLI source against the otherwise identical tree:
NativeModules.cppThe isolated source was restored afterward and is clean. These are Linux-host conversion/output checks, including PE generation, not Windows-host execution, actual title relinks, or the web converter path.