Skip to content

fix(relinker): bind Linux guest imports by declared module identity - #2212

Merged
adriadam10 merged 2 commits into
boykopovar:mainfrom
exefer:fix/relinker-linux-declared-binding
Oct 11, 2026
Merged

adriadam10 merged 2 commits into
boykopovar:mainfrom
exefer:fix/relinker-linux-declared-binding

Conversation

@exefer

@exefer exefer commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

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_NEEDED list. 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 M4YYbSFfJ8g declared from the needed Il2cppUserAssemblies.prx while Media/Plugins/kitt_support-PS5-shipping.prx incidentally exports the same NID, and kitt_webkit-PS5-shipping.prx imports smbQukfxYJM declared from kitt_support.prx while Il2cppUserAssemblies.prx exports it too.

Tested

  • Linux (CachyOS), GCC 16.2.1, Intel i5-12400 + NVIDIA RTX 3060 Ti (615.71.09), ANYPS5_RELINKER_ONLY=ON, BUILD_TESTING=ON: 110/110 relinker tests pass, including the existing ambiguity regressions (fixtures declare nothing, so they still throw).
  • PPSA29413 relinked with --registry --module-dir Media/Plugins --module-dir Media/Modules --to-intel: converts all bundled, needed and plugin modules (was: hard error). Note: current main no longer discovers needed modules outside the module directories (41126bf), so Media/Modules is now passed explicitly like Media/Plugins.

Checklist

@rmz-24

rmz-24 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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 plus libs. ea73d5e cherry-picked onto current main d70b899 (applies cleanly).

  • guest_module_identity, guest_symbol_names, guest_module_dir and guest_module_directories pass, with their Windows PE execution branches.
  • Full ctest: 512/512.

AI-assisted: yes

@SleglJan

SleglJan commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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 in prx/), relinker --registry on the unwrapped executable in all three cases:

AI-assisted: yes (Claude Code).

@adriadam10

Copy link
Copy Markdown
Collaborator

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 in DT_NEEDED and the import declared from it, the relink succeeds and the import becomes NID#guest. With both in DT_NEEDED, it still throws Ambiguous guest import. The test fails with the GuestModuleBuilder.cpp change reverted.

Merging.

@adriadam10
adriadam10 force-pushed the fix/relinker-linux-declared-binding branch from 100f3a7 to 364c893 Compare October 11, 2026 08:42
@adriadam10
adriadam10 merged commit cb052ff into boykopovar:main Oct 11, 2026
11 checks passed
@exefer
exefer deleted the fix/relinker-linux-declared-binding branch October 11, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants