fix(relinker): relink the modules that found needed modules need #1782
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1782"
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 MathiasDevelopes on 2026-10-08T19:06:33Z.
What
When the executable needs a module that is not in
sce_module,sce_modulesorprx, the relinker searches the input tree for it and relinks it. The modules that this found module needs in turn were not looked up. They were left as host libraries, which no host provides, so the title failed to load.The needed names of every module found this way are now searched for the same way, round by round, until no new module turns up. Each name is searched once, so a dependency cycle ends the search. Names that nothing in the input provides stay host libraries, as before. Ambiguity, exclusion (
--exclude-sce-module) and the skipped module directories work as before. Each found module is parsed once, and the parsed image is reused when the modules are relinked.The scope is kept narrow. Only modules found by this search have their needs followed. Modules in
sce_module,sce_modulesandprxare unchanged, and their needs resolve as before.Example: Planet Coaster (PPSA01736) needs
libcohtml.Prospero.prxat the package root, and that module needslibChakraCore.prxandlibRenoirCore.PS5.prxbeside it. Before, only cohtml was relinked; now all three are.Tested
Windows 11, MinGW-w64 15.2.0.
test_guest_needed_modules.pyadds two cases, each for both Linux ELF and Windows PE output:The first case fails without the fix. The relinker-only build passes its tests (36/36), and so does the full build (476/476).
tools/check_conventions.py --base origin/mainpasses. Converting PPSA01736 now relinks cohtml, ChakraCore and RenoirCore, and the title loads them. Not built or run on Linux or macOS.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-10-08T19:06:39Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T03:19:00Z.
This conflicts with main after today's merges; could you rebase? It passed testing and is otherwise ready.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T07:12:20Z.
Review: CHANGES_REQUESTED
The rebase isn't mechanical: since this PR was opened, #1503/#1830 changed the same block of
GuestModuleBuilder.cpp(needed names matched by stem/alias and by module identity, images preloaded intodiscovered), so bothGuestModuleBuilder.cppandtest_guest_needed_modules.pyconflict.Please rebase on current
mainand carry the round-by-round search over the new logic: the dependencies of each module found this way must go through the same exact/stem/identity matching, each name searched once, and the parsed image still reused when the modules are relinked. Keep both new test cases (transitive, and transitive with a host library), and check they still fail without the fix.Dean already said it passed testing; once rebased with CI green it can go in.
Imported from boykopovar/AnyPS5. Originally posted by SCD28 on 2026-10-10T08:18:24Z.
Rebuilt the PR changes on current main, preserving the newer exact-name, stem/alias and module-identity resolution already present in GuestModuleBuilder.
The transitive lookup now runs round by round, tracks searched dependency names so cycles terminate, and reuses parsed images already present in discovered. Missing package modules still remain host libraries.
The existing regression coverage now includes:
I also verified the regression directly: with only the transitive loop removed, guest_needed_nested_modules fails because libTransitive.prx.guest.prx is not produced. With the fix restored, the same test passes.
Validation on Linux / WSL2 Ubuntu 24.04:
AI-assisted: yes. (Codex)
Clean branch:
SCD28/AnyPS5:fix/relinker-transitive-needed-modules
Feel free to cherry-pick or reuse the branch if useful.
Imported from boykopovar/AnyPS5. Originally posted by MathiasDevelopes on 2026-10-10T09:12:23Z.
@oneandonlydean @adriadam10 Rebased onto current main. Since the needed-module search now also matches by stem and module identity, I moved that whole search into a step that reruns on the dependencies of each module it finds, until nothing new turns up. The first pass behaves exactly as on main. The two new tests (
transitive,transitive-host) fail on main and pass here, and all relinker tests pass.Imported from boykopovar/AnyPS5. Originally posted by MathiasDevelopes on 2026-10-10T14:06:18Z.
Closing this one.
41126bfaremoved the search for modules outside sce_module/sce_modules/prx, which is the code this PR extended. Now every module directly in those folders is relinked, so a module's own dependencies are picked up when they sit there too. I checked this on current main: a module in sce_module that needs another one relinks both in the right order, and a dependency nothing provides stays a host library. If a title turns up with modules outside those folders, I'll open a new issue for it.Pull request closed