fix(relinker): start on Windows without a missing library nothing imports from #3129

Merged
CnRJay merged 3 commits from upstream-pr/3129 into main 2026-10-11 07:11:54 +00:00
CnRJay commented 2026-10-10 22:50:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-10T22:50:26Z.


What

The Windows start-up stub stops with error 126 at the first needed library it cannot load, even when the title imports nothing from it. Road of Death and Record of Lodoss War list libSceXml.prx; Resident Evil 4 lists Party.prx. A host library that no import is searched in is now skipped with a message when it is not found. A missing library something imports from, other load errors and guest modules still stop the start.

Imports whose module matches no needed library keep their declared module name, so they count only against the library they declare. A module declared as libGuest still keeps a missing libGuest.xyz required.

Closes #2591. Fixes the Party.prx stop in #2776 (the title then stops at setSpecialFloatFormatType, tracked there).

Carried from Silverash-i8's fork branch fix/windows-start-without-unused-library (two commits, original authorship kept); the unnamed-import rule is from xXPBSXx.

Tested

Windows 11, MinGW-w64 GCC, relinker-only build (ANYPS5_RELINKER_ONLY=ON): ctest 99/99, including windows_import_modules and guest_module_identity. tools/check_conventions.py --base upstream/main passes. Not run on a title by me; xXPBSXx reported on #2591 that Record of Lodoss War (PPSA05347) and Resident Evil 4 (PPSA07411) pass the missing-library stop with these commits (...\libs\libSceXml.prx -> not found; nothing is imported from it, continuing without it), and that PRAGMATA and Returnal are unchanged.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4814999396 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-10T22:50:26Z. --- ### What The Windows start-up stub stops with error 126 at the first needed library it cannot load, even when the title imports nothing from it. Road of Death and Record of Lodoss War list `libSceXml.prx`; Resident Evil 4 lists `Party.prx`. A host library that no import is searched in is now skipped with a message when it is not found. A missing library something imports from, other load errors and guest modules still stop the start. Imports whose module matches no needed library keep their declared module name, so they count only against the library they declare. A module declared as `libGuest` still keeps a missing `libGuest.xyz` required. Closes #2591. Fixes the `Party.prx` stop in #2776 (the title then stops at `setSpecialFloatFormatType`, tracked there). Carried from Silverash-i8's fork branch `fix/windows-start-without-unused-library` (two commits, original authorship kept); the unnamed-import rule is from xXPBSXx. ### Tested Windows 11, MinGW-w64 GCC, relinker-only build (`ANYPS5_RELINKER_ONLY=ON`): `ctest` 99/99, including `windows_import_modules` and `guest_module_identity`. `tools/check_conventions.py --base upstream/main` passes. Not run on a title by me; xXPBSXx reported on #2591 that Record of Lodoss War (PPSA05347) and Resident Evil 4 (PPSA07411) pass the missing-library stop with these commits (`...\libs\libSceXml.prx -> not found; nothing is imported from it, continuing without it`), and that PRAGMATA and Returnal are unchanged. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Dextroid17 commented 2026-10-10 23:24:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-10T23:24:11Z.

Review: COMMENTED


The distinction this draws is the whole change, and it is drawn correctly: a library that nothing imports from is skipped with a message, while a missing library something does import from, any other load error, and guest modules all still stop the start. Widening the skip as far as the symptom would have turned a hard failure into a silent one, and the second half — imports whose module matches no needed library keeping their declared name, so each counts only against the library it declares — is what stops that from becoming a loophole.

The titles are named, which is the bar this tree asks for, and the two cases read differently for a reason: libSceXml.prx and Party.prx are carried dependencies the title never calls into, which is exactly the shape the fix is for.

One thing checked, because it is the failure mode of this change. The skipped-library line is emitted unconditionally — only the path echo beside it sits behind --windows-diagnostics — so a plain --windows run says which library was skipped and why. That is the right default: the alternative is a start that succeeds while a library quietly did not load, with nothing on screen to say so.

And closing the issue it fixes, with the Party.prx case named, is the right way to write the description — a reader can check both titles against their own copies.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481174495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#pullrequestreview-5481174495). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-10T23:24:11Z. **Review:** COMMENTED --- The distinction this draws is the whole change, and it is drawn correctly: a library that nothing imports from is skipped with a message, while a missing library something *does* import from, any other load error, and guest modules all still stop the start. Widening the skip as far as the symptom would have turned a hard failure into a silent one, and the second half — imports whose module matches no needed library keeping their declared name, so each counts only against the library it declares — is what stops that from becoming a loophole. **The titles are named, which is the bar this tree asks for**, and the two cases read differently for a reason: `libSceXml.prx` and `Party.prx` are carried dependencies the title never calls into, which is exactly the shape the fix is for. **One thing checked, because it is the failure mode of this change.** The skipped-library line is emitted unconditionally — only the path echo beside it sits behind `--windows-diagnostics` — so a plain `--windows` run says which library was skipped and why. That is the right default: the alternative is a start that succeeds while a library quietly did not load, with nothing on screen to say so. **And closing the issue it fixes, with the `Party.prx` case named, is the right way to write the description** — a reader can check both titles against their own copies. Written with AI assistance.
oneandonlydean commented 2026-10-11 01:08:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T01:08:25Z.


Please leave the needed libraries nothing imports from out of the start-up load list, instead of continuing after LoadLibrary fails with 126 (unusedMissing in WindowsEntryStubBuilder.cpp). Carrying on after a failed load is a fallback, which isn't allowed here, and the relinker already knows which libraries those are.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104053266 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6104053266). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T01:08:25Z. --- Please leave the needed libraries nothing imports from out of the start-up load list, instead of continuing after `LoadLibrary` fails with 126 (`unusedMissing` in `WindowsEntryStubBuilder.cpp`). Carrying on after a failed load is a fallback, which isn't allowed here, and the relinker already knows which libraries those are.
CnRJay commented 2026-10-11 01:14:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-11T01:14:26Z.


Done in the latest commit: the start-up stub no longer loads needed libraries that no import is searched in, so there is no LoadLibrary failure path or continue-after-126 branch left. The "Searched libraries" list also omits them. windows_import_modules now asserts the run exits 11 without mentioning the unused library; relinker ctest passes.

🤖 Addressed by Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6104096046 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6104096046). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-11T01:14:26Z. --- Done in the latest commit: the start-up stub no longer loads needed libraries that no import is searched in, so there is no `LoadLibrary` failure path or continue-after-126 branch left. The "Searched libraries" list also omits them. `windows_import_modules` now asserts the run exits 11 without mentioning the unused library; relinker `ctest` passes. _🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
reyani-dev commented 2026-10-11 04:29:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by reyani-dev on 2026-10-11T04:29:40Z.


Windows run of the current head (7755e1d0) merged onto main 961b25fe: Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, relinker-only build (ANYPS5_RELINKER_ONLY=ON, BUILD_TESTING=ON).

  • ctest: 100/100 pass, including windows_import_modules and guest_module_identity.
  • I relinked 48 open-source catalog homebrew executables with --windows --registry, once with this merge and once with a relinker built from main 961b25fe. Relink results are the same: 41 succeed and 7 stop with rc 2 on both. Once the output paths are normalized, the relinker logs are identical. This was a static check only; I did not run the outputs, so it doesn't exercise the start-up skip itself.

Two small things from reading the latest commit:

  1. WindowsEntryStubBuilder.cpp:153 still adds skippedModule (" -> not found; nothing is imported from it, continuing without it\n"), but after the review change nothing references it. The string is now written into every stub's data and never used.
  2. The description still says such a library "is now skipped with a message when it is not found" and quotes that message as xXPBSXx's result. After the latest commit, the library is never loaded at all, so the message no longer appears. The Lodoss / RE4 log lines in the Tested section are from the earlier commits.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105443011 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6105443011). Originally posted by [reyani-dev](https://github.com/reyani-dev) on 2026-10-11T04:29:40Z. --- Windows run of the current head (`7755e1d0`) merged onto `main` `961b25fe`: Windows 11 (10.0.26200), WinLibs GCC 15.2.0 r7, Release, relinker-only build (`ANYPS5_RELINKER_ONLY=ON`, `BUILD_TESTING=ON`). - `ctest`: 100/100 pass, including `windows_import_modules` and `guest_module_identity`. - I relinked 48 open-source catalog homebrew executables with `--windows --registry`, once with this merge and once with a relinker built from `main` `961b25fe`. Relink results are the same: 41 succeed and 7 stop with rc 2 on both. Once the output paths are normalized, the relinker logs are identical. This was a static check only; I did not run the outputs, so it doesn't exercise the start-up skip itself. Two small things from reading the latest commit: 1. `WindowsEntryStubBuilder.cpp:153` still adds `skippedModule` (`" -> not found; nothing is imported from it, continuing without it\n"`), but after the review change nothing references it. The string is now written into every stub's data and never used. 2. The description still says such a library "is now skipped with a message when it is not found" and quotes that message as xXPBSXx's result. After the latest commit, the library is never loaded at all, so the message no longer appears. The Lodoss / RE4 log lines in the Tested section are from the earlier commits.
oneandonlydean commented 2026-10-11 05:05:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T05:05:46Z.


A library that an import is still searched in has to stay in the load list. At 7755e1d0 it doesn't when the import has no matching library: WindowsEntryStubBuilder.cpp:127 marks a library only when import.Library is set, and :143 only by the declared module's name, while the search order of such an import still holds every library.

An executable needing a.prx (host library in libs/, nothing in sce_module) that imports shared, or shared#A#B with module libSceJson, exits 11 on main 961b25fe. With this head it stops:

FAIL: unresolved ELF import shared
Searched libraries:

Please fix that and add the case to windows_import_modules; the three new cases pass only because their provider is a guest module, which is always loaded. skippedModule (:153) is unused now.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105682919 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6105682919). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T05:05:46Z. --- A library that an import is still searched in has to stay in the load list. At 7755e1d0 it doesn't when the import has no matching library: `WindowsEntryStubBuilder.cpp:127` marks a library only when `import.Library` is set, and `:143` only by the declared module's name, while the search order of such an import still holds every library. An executable needing `a.prx` (host library in `libs/`, nothing in `sce_module`) that imports `shared`, or `shared#A#B` with module `libSceJson`, exits 11 on `main` 961b25fe. With this head it stops: ``` FAIL: unresolved ELF import shared Searched libraries: ``` Please fix that and add the case to `windows_import_modules`; the three new cases pass only because their provider is a guest module, which is always loaded. `skippedModule` (`:153`) is unused now.
github-actions[bot] commented 2026-10-11 05:30:06 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T05:30:06Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
#2705 core/relinker/domain/include/domain/GuestRuntime.hpp L26
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6105845583 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6105845583). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T05:30:06Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #2705 | `core/relinker/domain/include/domain/GuestRuntime.hpp` [L26](https://github.com/boykopovar/AnyPS5/blob/bae99629541c0f0f15ab73033eb7b53f33bf8ab8/core/relinker/domain/include/domain/GuestRuntime.hpp#L26) | | |
adriadam10 commented 2026-10-11 07:11:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T07:11:52Z.


Checked the diff, relinker build and ctest (94/94) on current main, and the Windows relinker job (windows_import_modules asserts exit 11 and no mention of the unused library). Libraries nothing imports from are now left out of the start-up load list, which covers Dean's request; missing libraries something imports from, other load errors and guest modules still stop the start. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6106553705 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6106553705). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T07:11:52Z. --- Checked the diff, relinker build and ctest (94/94) on current main, and the Windows relinker job (`windows_import_modules` asserts exit 11 and no mention of the unused library). Libraries nothing imports from are now left out of the start-up load list, which covers Dean's request; missing libraries something imports from, other load errors and guest modules still stop the start. Merging.
xXPBSXx commented 2026-10-11 09:09:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T09:09:36Z.


FYI for the authors of this change (@Silverash-i8, @CnRJay): the last commit here (7755e1d0, needed libraries nothing imports from are left out of the start-up load) breaks start-up on Hotline Miami (PPSA09682): an import without a library name (sceAppContentAddcontMount) can no longer be resolved because libSceAppContent.prx is no longer loaded. Bisect, evidence and a fix with a regression test are in #3367. The Party.prx case should stay working with that fix (missing library file tolerated, message restored).

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107444464 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6107444464). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-11T09:09:36Z. --- FYI for the authors of this change (@Silverash-i8, @CnRJay): the last commit here (`7755e1d0`, needed libraries nothing imports from are left out of the start-up load) breaks start-up on Hotline Miami (PPSA09682): an import without a library name (`sceAppContentAddcontMount`) can no longer be resolved because `libSceAppContent.prx` is no longer loaded. Bisect, evidence and a fix with a regression test are in #3367. The Party.prx case should stay working with that fix (missing library file tolerated, message restored). AI-assisted (Claude Code).
CnRJay commented 2026-10-11 13:16:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-11T13:16:54Z.


FYI for the authors of this change (@Silverash-i8, @CnRJay): the last commit here (7755e1d0, needed libraries nothing imports from are left out of the start-up load) breaks start-up on Hotline Miami (PPSA09682): an import without a library name (sceAppContentAddcontMount) can no longer be resolved because libSceAppContent.prx is no longer loaded. Bisect, evidence and a fix with a regression test are in #3367. The Party.prx case should stay working with that fix (missing library file tolerated, message restored).

AI-assisted (Claude Code).

Will investigate. Thanks

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109426410 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6109426410). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-11T13:16:54Z. --- > FYI for the authors of this change (@Silverash-i8, @CnRJay): the last commit here (`7755e1d0`, needed libraries nothing imports from are left out of the start-up load) breaks start-up on Hotline Miami (PPSA09682): an import without a library name (`sceAppContentAddcontMount`) can no longer be resolved because `libSceAppContent.prx` is no longer loaded. Bisect, evidence and a fix with a regression test are in #3367. The Party.prx case should stay working with that fix (missing library file tolerated, message restored). > > AI-assisted (Claude Code). > Will investigate. Thanks
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3129
No description provided.