fix(relinker): bind Linux guest imports by declared module identity #2212
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2212"
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 exefer on 2026-10-09T11:45:08Z.
What
On Linux, any executable import or guest-module import whose NID two bundled modules export is a hard error, even when the import declares one of them. Windows already binds such imports to their declared module (#684).
Executable imports shared between providers bind when exactly one provider's filename or SONAME is in the executable's
DT_NEEDEDlist. Guest-module imports shared between providers bind when the declared library resolves to one of the providers, on both platforms (the Windows-only filter already did this on Windows). Anything else still throws as before: undeclared, host-declared and multiply-declared imports are unchanged.Demonstrated by Wobbly Life (PPSA29413, Unity; bring-up: #2211): its executable imports
M4YYbSFfJ8gdeclared from the neededIl2cppUserAssemblies.prxwhileMedia/Plugins/kitt_support-PS5-shipping.prxincidentally exports the same NID, andkitt_webkit-PS5-shipping.prximportssmbQukfxYJMdeclared fromkitt_support.prxwhileIl2cppUserAssemblies.prxexports it too.Tested
ANYPS5_RELINKER_ONLY=ON,BUILD_TESTING=ON: 110/110 relinker tests pass, including the existing ambiguity regressions (fixtures declare nothing, so they still throw).--registry --module-dir Media/Plugins --module-dir Media/Modules --to-intel: converts all bundled, needed and plugin modules (was: hard error). Note: currentmainno longer discovers needed modules outside the module directories (41126bfa), soMedia/Modulesis now passed explicitly likeMedia/Plugins.Checklist
main; no other open PR implements the same functions (checked: #684 is Windows-only, #1529 covers host-vs-guest, #1503 covers identities, none binds Linux guest-vs-guest by declared module)Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T12:45:31Z.
Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
-DANYPS5_ENABLE_SPIRV_TOOLS=ON, full build pluslibs. ea73d5ed cherry-picked onto currentmaind70b8998(applies cleanly).guest_module_identity,guest_symbol_names,guest_module_dirandguest_module_directoriespass, with their Windows PE execution branches.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by SleglJan on 2026-10-09T19:35:06Z.
A second title for this, on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1): Until Dawn (PPSA15421 v01.005.000, Unreal, 7 Sony modules in
sce_module/and 28 Wwise plugins inprx/),relinker --registryon the unwrapped executable in all three cases:mainf8c2f072: refused withAmbiguous guest import BfBDZGbti7A(sceAgcGetIsTrinityMode, declared fromlibSceAgc), exported by both bundledlibSceFontGsm.prxandlibSceJobManager.prx: the host-declared case #1529 covers.d70b8998without the last commit (2d262e84, a relinker-only build): refused withAmbiguous guest import P330P3dFF68(Need_sceLibc, declared fromlibc.prx), exported bylibc.prxand all 27ak*/auro/masteringsuiteplugins inprx/; onlylibc.prxis among the executable'sDT_NEEDEDentries, which is the rule this PR adds.prx/is scanned as onmain; passing--module-dir prxas well is refused as a duplicate directory), 644 imports implemented, 54 throwing stubs, 1 absent import. Given 8 s in a bubblewrap sandbox, the host loader stops at that absent import,sceAudioPropagationSourceSetAudioPath(tKSmk2JsMAA, the export #1947 adds), so both ambiguities are gone.AI-assisted: yes (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T08:42:02Z.
Checked on Linux, merged onto current main: relinker build and ctest 99/99 pass. Windows 512/512 and a second title (Until Dawn) are reported above.
The PR had no test, so I added one commit on top:
test_guest_symbol_names.py: two guest modules export the same NID. With only one inDT_NEEDEDand the import declared from it, the relink succeeds and the import becomesNID#guest. With both inDT_NEEDED, it still throwsAmbiguous guest import. The test fails with theGuestModuleBuilder.cppchange reverted.Merging.