Windows: since #3129 a library an unmatched import is searched in is not loaded (Middle Ages Ping Pong PPSA28319 stops on sceAppContentAddcontMount); fix branch ready #3369

Closed
opened 2026-10-11 09:15:43 +00:00 by DavidSamir · 3 comments
DavidSamir commented 2026-10-11 09:15:43 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-11T09:15:43Z.


Since #3129 (merge bbb941964), a Windows executable no longer loads a host library that one of its imports is still searched in, when that import matched no library by module name. The import is then reported as unresolved although the library that exports it is in libs. This is the case @oneandonlydean described in review before the merge; it is on main now.

Title. Middle Ages Ping Pong (PPSA28319, Unity, MIT, from the homebrew catalog) stops at start-up on main fd50c632a:

FAIL: unresolved ELF import VANhIWcqYak
Searched libraries:
  ...\out\app0\sce_module\libc.prx.guest.prx
  ...
  ...\out\libs\libc.prx
GetLastError: 127 - The specified procedure could not be found.

VANhIWcqYak is sceAppContentAddcontMount. The list has 36 entries and libSceAppContent.prx is not among them, although it is in libs and exports the function. With the relinker of main 0e90079f (before #3129) the same title started, loaded its Unity level and stopped later at multisampling or coverage conversion is unsupported.

Cause. The executable needs libSceAppContent.prx, but its import module for that library is named libSceAppContentUtil:

NEEDED         libSceAppContent.prx
IMPORT_MODULE  id X  libSceAppContentUtil
IMPORT_LIB     id X  libSceAppContent

Its eight ...#X#X imports (sceAppContentInitialize, sceAppContentAddcontMount, sceAppContentAddcontUnmount, sceAppContentAppParamGetInt, sceAppContentTemporaryDataMount2, sceAppContentTemporaryDataFormat, sceAppContentTemporaryDataGetAvailableSpaceKb, sceAppContentDownloadDataGetAvailableSpaceKb) therefore match no needed library, get an empty Library, and are searched in every library, as before. WindowsEntryStubBuilder.cpp keeps a host library on the load list only when an import with a matched library is searched in it, or when its name equals an unmatched module name up to the first dot. libSceAppContent is not libSceAppContentUtil, so the library is left out, together with libSceAudio3d.prx and libSceRazorCpu.prx.

The same happens without any guest module: an executable that needs host a.prx and imports shared, or shared#A#B with module libSceJson, exits 11 before #3129 and stops with an empty "Searched libraries" list on main. #3356 reports the same stop for Road of Death (PPSA07286, libSceJson2.prx not in the searched libraries), and the closed #3344 for Pinball FX (PPSA08755, module libSceJson, library libSceJson2.prx). I don't have either title; in the fixture, module libSceJson with a library of another name is one of the new cases.

Fix, ready to cherry-pick. DavidSamir:fix/relinker-windows-load-searched-libraries (a0e026b99, one commit on main fd50c632a, eight files, +45/-9). I can't open it as a PR because of the intake check.

The load list is still decided when relinking; nothing is retried or skipped at run time, and a library on the list that cannot be loaded still stops the start with error 126.

  • Every host library stays on the load list when both hold: an import without a matched library is exported by no guest module, and an unmatched import module (or an import with no module at all) names no needed host library. Such an import can only come from a host library, and which one is not known when relinking.
  • Otherwise nothing changes. A library nothing is imported from is still left out when every import has a matched library, when the unmatched imports are exported by a guest module (as in the missing-unused-dependency cases of #3129), or when the unmatched module names a needed library up to the first dot (libSceAjm and libSceAjm.native.prx).
  • For that, the relinker passes the set of guest export names to the stub builder, and records an import that has no module with an empty module name.
  • skippedModule is removed; it has been unused since 7755e1d05.

Limit: when the rule keeps every library, a needed library that is missing and unused stops the start again, as it did before #3129. A title that has both an import like the ones above and such a library would need the import matched to its library by another key (the executable's import library name is libSceAppContent, which the relinker does not read); that is not part of this change. I could not check Record of Lodoss War, Road of Death or Resident Evil 4, the titles #3129 was written for.

windows_import_modules gains nine cases whose provider is a host library in libs with no guest module: a matched import, shared, shared#A#B with module libSceJson, the provider as second needed library behind libFooUtil.prx, module libFooUtil for needed libFoo.prx (the shape of the title), a matched import with a missing unused library, module a for a.native.prx with a missing unused library (still skipped), and the two unmatched imports with a missing unused library (stop with Failed to load module: ...unused.prx).

Checked on Windows (a0e026b99 on main fd50c632a, Windows 11 10.0.26300, WinLibs GCC 15.2.0 r7, Release):

  • With the relinker sources of main and the new cases kept, windows_import_modules fails at the shared case with the empty "Searched libraries" output above. Run one by one against the relinker of main 05c870cc0, six of the nine cases fail (the three with a matched import or module pass). With the fix windows_import_modules and guest_module_identity pass 5/5 (--repeat until-fail:5).
  • PPSA28319, relinked with the relinker of main fd50c632a and with the branch, same libraries (built from main a258e5e3e): main stops after 3 s with the output above; the branch starts, opens its Unity data files and stops after 7 s with read-write alias of shared guest memory 0x2144c0000+0x1040000: the range is not one contiguous run of views of a section. I have not looked into that later stop. With --windows-diagnostics (measured on the previous base, a4b0b16bb) the branch prints 39 Loading PRX lines against 36: libSceAppContent.prx, libSceAudio3d.prx and libSceRazorCpu.prx are added.
  • 42 other catalog executables that relink, built with --windows-diagnostics by the relinker of main a4b0b16bb and by the branch on that base (the same change before the rebase) and run for 5 s: 41 print the same Loading PRX list and the same first stop. For PSBox Cloud Gaming (PPSA99810) the executable from main printed one libSceAgc.prx -> FAILED in that batch; three reruns of both executables gave the same 19 libraries and the same stop. I did not find out why that one load failed.
  • Relinker-only build (ANYPS5_RELINKER_ONLY=ON): ctest 105/105. check_conventions.py --base origin/main passes; pr_overlap.py --branch reports no overlap with open pull requests.
  • Full build on the previous base (the same change on main 05c870cc0), ctest --parallel 4, 801 tests: seven GPU tests fail on this machine (RTX 3070, driver 610.60): agc_driver_bda_device, agc_driver_f32_compare_constant and agc_driver_flat_apertures_0, _2, _3, _4, _5. Their executables are built only from sources outside core/relinker, which is all this branch changes; I did not rerun them on a build of plain main.

Checked on Linux (same commit, WSL2 Ubuntu 24.04, GCC 13.3.0, Release, relinker-only build): ctest 110/110. The new cases relink there; they only run on Windows.

Not checked on a console, on macOS, or with a commercial title.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5799724852 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3369). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-11T09:15:43Z. --- Since #3129 (merge bbb941964), a Windows executable no longer loads a host library that one of its imports is still searched in, when that import matched no library by module name. The import is then reported as unresolved although the library that exports it is in `libs`. This is the case @oneandonlydean described in review [before the merge](https://github.com/boykopovar/AnyPS5/pull/3129#issuecomment-6105682919); it is on `main` now. **Title.** Middle Ages Ping Pong (PPSA28319, Unity, MIT, from the homebrew catalog) stops at start-up on `main` fd50c632a: ``` FAIL: unresolved ELF import VANhIWcqYak Searched libraries: ...\out\app0\sce_module\libc.prx.guest.prx ... ...\out\libs\libc.prx GetLastError: 127 - The specified procedure could not be found. ``` `VANhIWcqYak` is `sceAppContentAddcontMount`. The list has 36 entries and `libSceAppContent.prx` is not among them, although it is in `libs` and exports the function. With the relinker of `main` 0e90079f (before #3129) the same title started, loaded its Unity level and stopped later at `multisampling or coverage conversion is unsupported`. **Cause.** The executable needs `libSceAppContent.prx`, but its import module for that library is named `libSceAppContentUtil`: ``` NEEDED libSceAppContent.prx IMPORT_MODULE id X libSceAppContentUtil IMPORT_LIB id X libSceAppContent ``` Its eight `...#X#X` imports (`sceAppContentInitialize`, `sceAppContentAddcontMount`, `sceAppContentAddcontUnmount`, `sceAppContentAppParamGetInt`, `sceAppContentTemporaryDataMount2`, `sceAppContentTemporaryDataFormat`, `sceAppContentTemporaryDataGetAvailableSpaceKb`, `sceAppContentDownloadDataGetAvailableSpaceKb`) therefore match no needed library, get an empty `Library`, and are searched in every library, as before. [`WindowsEntryStubBuilder.cpp`](https://github.com/boykopovar/AnyPS5/blob/fd50c632a/core/relinker/elfpatcher/src/windows/WindowsEntryStubBuilder.cpp#L163-L182) keeps a host library on the load list only when an import with a matched library is searched in it, or when its name equals an unmatched module name up to the first dot. `libSceAppContent` is not `libSceAppContentUtil`, so the library is left out, together with `libSceAudio3d.prx` and `libSceRazorCpu.prx`. The same happens without any guest module: an executable that needs host `a.prx` and imports `shared`, or `shared#A#B` with module `libSceJson`, exits 11 before #3129 and stops with an empty "Searched libraries" list on `main`. #3356 reports the same stop for Road of Death (PPSA07286, `libSceJson2.prx` not in the searched libraries), and the closed #3344 for Pinball FX (PPSA08755, module `libSceJson`, library `libSceJson2.prx`). I don't have either title; in the fixture, module `libSceJson` with a library of another name is one of the new cases. **Fix, ready to cherry-pick.** [`DavidSamir:fix/relinker-windows-load-searched-libraries`](https://github.com/boykopovar/AnyPS5/compare/main...DavidSamir:AnyPS5:fix/relinker-windows-load-searched-libraries) (a0e026b99, one commit on `main` fd50c632a, eight files, +45/-9). I can't open it as a PR because of the intake check. The load list is still decided when relinking; nothing is retried or skipped at run time, and a library on the list that cannot be loaded still stops the start with error 126. - Every host library stays on the load list when both hold: an import without a matched library is exported by no guest module, and an unmatched import module (or an import with no module at all) names no needed host library. Such an import can only come from a host library, and which one is not known when relinking. - Otherwise nothing changes. A library nothing is imported from is still left out when every import has a matched library, when the unmatched imports are exported by a guest module (as in the `missing-unused-dependency` cases of #3129), or when the unmatched module names a needed library up to the first dot (`libSceAjm` and `libSceAjm.native.prx`). - For that, the relinker passes the set of guest export names to the stub builder, and records an import that has no module with an empty module name. - `skippedModule` is removed; it has been unused since 7755e1d05. Limit: when the rule keeps every library, a needed library that is missing and unused stops the start again, as it did before #3129. A title that has both an import like the ones above and such a library would need the import matched to its library by another key (the executable's import library name is `libSceAppContent`, which the relinker does not read); that is not part of this change. I could not check Record of Lodoss War, Road of Death or Resident Evil 4, the titles #3129 was written for. `windows_import_modules` gains nine cases whose provider is a host library in `libs` with no guest module: a matched import, `shared`, `shared#A#B` with module `libSceJson`, the provider as second needed library behind `libFooUtil.prx`, module `libFooUtil` for needed `libFoo.prx` (the shape of the title), a matched import with a missing unused library, module `a` for `a.native.prx` with a missing unused library (still skipped), and the two unmatched imports with a missing unused library (stop with `Failed to load module: ...unused.prx`). **Checked on Windows** (a0e026b99 on `main` fd50c632a, Windows 11 10.0.26300, WinLibs GCC 15.2.0 r7, Release): - With the relinker sources of `main` and the new cases kept, `windows_import_modules` fails at the `shared` case with the empty "Searched libraries" output above. Run one by one against the relinker of `main` 05c870cc0, six of the nine cases fail (the three with a matched import or module pass). With the fix `windows_import_modules` and `guest_module_identity` pass 5/5 (`--repeat until-fail:5`). - PPSA28319, relinked with the relinker of `main` fd50c632a and with the branch, same libraries (built from `main` a258e5e3e): `main` stops after 3 s with the output above; the branch starts, opens its Unity data files and stops after 7 s with `read-write alias of shared guest memory 0x2144c0000+0x1040000: the range is not one contiguous run of views of a section`. I have not looked into that later stop. With `--windows-diagnostics` (measured on the previous base, a4b0b16bb) the branch prints 39 `Loading PRX` lines against 36: `libSceAppContent.prx`, `libSceAudio3d.prx` and `libSceRazorCpu.prx` are added. - 42 other catalog executables that relink, built with `--windows-diagnostics` by the relinker of `main` a4b0b16bb and by the branch on that base (the same change before the rebase) and run for 5 s: 41 print the same `Loading PRX` list and the same first stop. For PSBox Cloud Gaming (PPSA99810) the executable from `main` printed one `libSceAgc.prx -> FAILED` in that batch; three reruns of both executables gave the same 19 libraries and the same stop. I did not find out why that one load failed. - Relinker-only build (`ANYPS5_RELINKER_ONLY=ON`): `ctest` 105/105. `check_conventions.py --base origin/main` passes; `pr_overlap.py --branch` reports no overlap with open pull requests. - Full build on the previous base (the same change on `main` 05c870cc0), `ctest --parallel 4`, 801 tests: seven GPU tests fail on this machine (RTX 3070, driver 610.60): `agc_driver_bda_device`, `agc_driver_f32_compare_constant` and `agc_driver_flat_apertures_0`, `_2`, `_3`, `_4`, `_5`. Their executables are built only from sources outside `core/relinker`, which is all this branch changes; I did not rerun them on a build of plain `main`. **Checked on Linux** (same commit, WSL2 Ubuntu 24.04, GCC 13.3.0, Release, relinker-only build): `ctest` 110/110. The new cases relink there; they only run on Windows. Not checked on a console, on macOS, or with a commercial title. AI-assisted: yes
DavidSamir commented 2026-10-11 09:16:04 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-11T09:16:04Z.


#3365 was opened on the same stop while I was writing this up, so the two overlap in WindowsEntryStubBuilder.cpp and test_windows_import_modules.py. Its Planet Coaster import, 99b82IKXpH4, is sceAppContentAppParamGetInt, one of the eight libSceAppContentUtil imports listed above.

The difference between the two, for whoever reviews:

  • #3365 tries to load every needed host library when any import has no matched library, and carries on when such a load fails with error 126.
  • This branch decides the load list when relinking and adds no path that continues after a failed load, following the first review note on #3129. The cost is the limit described above: when every library has to stay on the list, a missing one stops the start as it did before #3129.

If #3365 is the one that goes in, the nine host-library cases in this branch's windows_import_modules change still apply to it, except the last two, which expect Failed to load module: ...unused.prx.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107495107 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3369#issuecomment-6107495107). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-11T09:16:04Z. --- #3365 was opened on the same stop while I was writing this up, so the two overlap in `WindowsEntryStubBuilder.cpp` and `test_windows_import_modules.py`. Its Planet Coaster import, `99b82IKXpH4`, is `sceAppContentAppParamGetInt`, one of the eight `libSceAppContentUtil` imports listed above. The difference between the two, for whoever reviews: - #3365 tries to load every needed host library when any import has no matched library, and carries on when such a load fails with error 126. - This branch decides the load list when relinking and adds no path that continues after a failed load, following the first review note on #3129. The cost is the limit described above: when every library has to stay on the list, a missing one stops the start as it did before #3129. If #3365 is the one that goes in, the nine host-library cases in this branch's `windows_import_modules` change still apply to it, except the last two, which expect `Failed to load module: ...unused.prx`. AI-assisted: yes
orishamir commented 2026-10-11 12:49:12 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-11T12:49:12Z.


@DavidSamir, on main this is fixed by #3365 (merged 09:40Z). Middle Ages Ping Pong (catalog zip, sha256 checked) on Windows 11 + RTX 4080, main 8b679d8d, relinked with --windows --windows-diagnostics --registry --module-dir Media/Modules --module-dir Media/Plugins:

  • main: loads libSceAppContent.prx, opens its Unity data (level0, sharedassets0.*, resources.assets) and stops after 15 s with presentation failed: multisampling or coverage conversion is unsupported (register 0x2f8 = 0x00108001), the later stop of your pre-#3129 run.
  • main with only WindowsEntryStubBuilder.cpp reverted to before #3365: FAIL: unresolved ELF import VANhIWcqYak after 3 s, libSceAppContent.prx not among the searched libraries, as in your report.

@xXPBSXx's #3367 is the same import and the same unnamed-module shape; a Hotline Miami run on main would confirm it there (I can't run that one). Without the two --module-dir options the title stops earlier at Failed to load module ...Il2cppUserAssemblies.prx (126), the stop recorded for it under #2942; that one is a relink step, not a blocker.

AI-assisted: yes (Claude Code Opus 5.5 xhigh)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109192382 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3369#issuecomment-6109192382). Originally posted by [orishamir](https://github.com/orishamir) on 2026-10-11T12:49:12Z. --- @DavidSamir, on `main` this is fixed by #3365 (merged 09:40Z). Middle Ages Ping Pong (catalog zip, sha256 checked) on Windows 11 + RTX 4080, `main` 8b679d8d, relinked with `--windows --windows-diagnostics --registry --module-dir Media/Modules --module-dir Media/Plugins`: - `main`: loads `libSceAppContent.prx`, opens its Unity data (`level0`, `sharedassets0.*`, `resources.assets`) and stops after 15 s with `presentation failed: multisampling or coverage conversion is unsupported (register 0x2f8 = 0x00108001)`, the later stop of your pre-#3129 run. - `main` with only `WindowsEntryStubBuilder.cpp` reverted to before #3365: `FAIL: unresolved ELF import VANhIWcqYak` after 3 s, `libSceAppContent.prx` not among the searched libraries, as in your report. @xXPBSXx's #3367 is the same import and the same unnamed-module shape; a Hotline Miami run on `main` would confirm it there (I can't run that one). Without the two `--module-dir` options the title stops earlier at `Failed to load module ...Il2cppUserAssemblies.prx` (126), the stop recorded for it under #2942; that one is a relink step, not a blocker. AI-assisted: yes (Claude Code Opus 5.5 xhigh)
oneandonlydean commented 2026-10-11 21:16:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T21:16:43Z.


Fixed by #3365, as the run on main 8b679d8d above shows.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113851649 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3369#issuecomment-6113851649). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T21:16:43Z. --- Fixed by #3365, as the run on main 8b679d8d above shows.
Sign in to join this conversation.
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#3369
No description provided.