feat(relinker): log deferred Windows modules the executable imports from #9228
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9228"
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 savvaniss on 2026-10-21T15:40:47Z.
What
This is the follow-up to #8162 that @oneandonlydean asked for in this comment.
Since #8162, a
--module-dirmodule that the executable needs is deferred on Windows. The entry stub maps it at startup, andDynamicLoaderruns itsmodule_startand initializers only when the title loads it withsceKernelLoadStartModule. If the executable imports from such a module but the title never loads it, the module gets neither, and nothing reported that.Now the Windows entry stub prints one line at startup for each deferred guest module that an import of the executable names. The lines come after the imports are bound and before
Transferring control to ELF entry point:DeferInitializationthat is in the search order of one of the executable's own imports, matched by file name or module identity. The stub uses the same match to bind the import. A guest module's own imports do not count. An import with no module name searches every library, so it is not reported.--executableconversions are unchanged.mono-ps4.sprx. I left out the optional second line (the first imported call runs before the module has started), because it needs a check on every call through those imports.Tested
Windows 11 Pro 26300, WinLibs GCC 15.2.0, Release, relinker-only build (
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON) onmaincecb540a63, then again after mergingmain6cd36e6517.ctest: 233/233 pass oncecb540a63. After the merge, 240/241 pass with-j8;conventions_env_referencetimed out at 60 s under load and passes alone in 32 s.guest_module_dir(new case): an executable that callssharedfromneeded.prx.needed.prxinMedia/Modules, converted with--module-dir Media/Modules: the Windows executable contains the line, prints it on stdout and exits with 42.needed.prxinsce_module, which starts at startup: the executable contains no such line and exits with 42.DT_NEEDEDentry in both directories.main'sWindowsEntryStubBuilder.cpp, the case fails (AssertionError: Media/Modules); with the change, it passes.mainalone, Boggle's conversion stops atlibSceFios2.prx(the fix is in #6977).tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py:guestStartup.Initialize, which would only be a textual conflict.docs/dev/debt/relinker.md. #7450, which touchedtest_guest_module_dir.py, is closed.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