fix(relinker): search libc.prx for libkernel-only Windows executables #5990

Merged
Get-fix merged 1 commit from upstream-pr/5990 into main 2026-10-16 23:16:01 +00:00
Get-fix commented 2026-10-14 18:36:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-14T18:36:49Z.


What

AnyPS5 exports some libkernel functions, such as __error, from libc.prx, which libkernel.prx links. On Linux they resolve through that dependency. On Windows the import stubs search only the modules listed for the executable, and libc.prx was listed only when libSceLibcInternal.prx was needed. PS4 homebrew built with the OpenOrbis toolchain imports __error from libkernel but needs no libSceLibcInternal.prx, so the OpenOrbis samples stop at start-up with FAIL: unresolved ELF import 9BcDykPmo1I (__error). libc.prx is now also listed when libkernel.prx is needed. PS5 executables need libSceLibcInternal.prx and convert unchanged. macOS has the same gap in its own patcher; that is recorded in the relinker debt file and not changed here.

Part of the PS4 homebrew work tracked in #3093.

Tested

Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON, on main e442f4c2e:

  • Relinker-only build: ctest 164/164. windows_dependency_diagnostics covers a libkernel-only executable; reverting the condition, or listing libc.prx twice, makes it fail.
  • ps5-doom, VLC and Jelly5 convert byte-identically with main.
  • OpenOrbis samples with the other changes listed in #3093 (left out one at a time on main 84b01f9cd, all together on e442f4c2e): without this change, the nine samples that otherwise start (graphics, input, pngdec, exceptions, hello_world, using_library, dialogs, audio-wav, net_http) all stop at FAIL: unresolved ELF import 9BcDykPmo1I; with it they start.
  • tools/check_conventions.py --base origin/main passes.

Not tested on Linux or macOS; the change is in the Windows import builder.

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 (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: OpenOrbis PS4 toolchain samples, #3093
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4862684936 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5990). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-14T18:36:49Z. --- ### What AnyPS5 exports some libkernel functions, such as `__error`, from libc.prx, which libkernel.prx links. On Linux they resolve through that dependency. On Windows the import stubs search only the modules listed for the executable, and libc.prx was listed only when libSceLibcInternal.prx was needed. PS4 homebrew built with the OpenOrbis toolchain imports `__error` from libkernel but needs no libSceLibcInternal.prx, so the OpenOrbis samples stop at start-up with `FAIL: unresolved ELF import 9BcDykPmo1I` (`__error`). libc.prx is now also listed when libkernel.prx is needed. PS5 executables need libSceLibcInternal.prx and convert unchanged. macOS has the same gap in its own patcher; that is recorded in the relinker debt file and not changed here. Part of the PS4 homebrew work tracked in #3093. ### Tested Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, on `main` `e442f4c2e`: - Relinker-only build: ctest 164/164. `windows_dependency_diagnostics` covers a libkernel-only executable; reverting the condition, or listing libc.prx twice, makes it fail. - ps5-doom, VLC and Jelly5 convert byte-identically with `main`. - OpenOrbis samples with the other changes listed in #3093 (left out one at a time on `main` `84b01f9cd`, all together on `e442f4c2e`): without this change, the nine samples that otherwise start (graphics, input, pngdec, exceptions, hello_world, using_library, dialogs, audio-wav, net_http) all stop at `FAIL: unresolved ELF import 9BcDykPmo1I`; with it they start. - `tools/check_conventions.py --base origin/main` passes. Not tested on Linux or macOS; the change is in the Windows import builder. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: OpenOrbis PS4 toolchain samples, #3093 - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Get-fix commented 2026-10-15 13:34:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T13:34:59Z.


I checked the overlap the bot lists. I fetched each listed pull request and, for every file it shares with this one, merged its change with git merge-file into current main (a5e2a80c6) and into main with this pull request merged. A conflict that appears only in the second case is one this pull request adds.

The bot lists 22 pull requests, with 22 shared files between them. This one adds a conflict in only one:

  • #5784 (ANDN lowering): both add a bullet at the same place in docs/dev/debt/relinker.md, this one the macOS libc.prx note and #5784 its ANDN note. Keeping both lines resolves it. No code is shared.

The other 21 merge the same with and without this pull request.

AI-assisted: yes (Claude Code). I ran these checks myself on Windows 11.

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6193360521 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5990#issuecomment-6193360521). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-15T13:34:59Z. --- I checked the overlap the bot lists. I fetched each listed pull request and, for every file it shares with this one, merged its change with `git merge-file` into current `main` (`a5e2a80c6`) and into `main` with this pull request merged. A conflict that appears only in the second case is one this pull request adds. The bot lists 22 pull requests, with 22 shared files between them. This one adds a conflict in only one: - **#5784** (ANDN lowering): both add a bullet at the same place in `docs/dev/debt/relinker.md`, this one the macOS `libc.prx` note and #5784 its ANDN note. Keeping both lines resolves it. No code is shared. The other 21 merge the same with and without this pull request. AI-assisted: yes (Claude Code). I ran these checks myself on Windows 11. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Get-fix commented 2026-10-15 18:37:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Get-fix on 2026-10-15T18:37:08Z.


Rebased onto main 03c4cb5e7 (now Get-fix/AnyPS5@8c3458759) for the needs rebase label. main had added an entry for the ANDN lowering at the end of docs/dev/debt/relinker.md, where this one adds its macOS libc.prx entry; I kept both. The code is unchanged. In a build of main 03c4cb5e7 with my other open pull requests, windows_dependency_diagnostics and windows_import_modules pass, the full ctest passes except two tests this change does not touch (agc_driver_gpu_indirect_arguments_misaligned_writer_ahead does not compile with MinGW on main (#6452 fixes it), and prx_thread_local_destructors fails as it did on main 92cdc7b62 on this machine without my changes), and 15 of the 16 OpenOrbis sample programs start (networking was not run).

AI-assisted: yes (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6199511284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5990#issuecomment-6199511284). Originally posted by [Get-fix](https://github.com/Get-fix) on 2026-10-15T18:37:08Z. --- Rebased onto `main` `03c4cb5e7` (now Get-fix/AnyPS5@8c3458759) for the **needs rebase** label. `main` had added an entry for the ANDN lowering at the end of `docs/dev/debt/relinker.md`, where this one adds its macOS `libc.prx` entry; I kept both. The code is unchanged. In a build of `main` `03c4cb5e7` with my other open pull requests, `windows_dependency_diagnostics` and `windows_import_modules` pass, the full ctest passes except two tests this change does not touch (`agc_driver_gpu_indirect_arguments_misaligned_writer_ahead` does not compile with MinGW on `main` (#6452 fixes it), and `prx_thread_local_destructors` fails as it did on `main` `92cdc7b62` on this machine without my changes), and 15 of the 16 OpenOrbis sample programs start (`networking` was not run). AI-assisted: yes (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-16 18:50:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-16T18:50:18Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5021 docs/dev/debt/relinker.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6222474398 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5990#issuecomment-6222474398). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-16T18:50:18Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `docs/dev/debt/relinker.md` |
adriadam10 commented 2026-10-16 20:07:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T20:07:42Z.


Checked the diff, the updated windows_dependency_diagnostics rows (libkernel-only, libc.prx already present, deduplicated list) and the macOS debt entry against MacOsMachOPatcher.cpp; relinker build and ctest are green on Linux (the Windows test is registered only for WIN32, so the full Windows Build covers it). Merging once that passes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6223747689 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5990#issuecomment-6223747689). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T20:07:42Z. --- Checked the diff, the updated `windows_dependency_diagnostics` rows (libkernel-only, libc.prx already present, deduplicated list) and the macOS debt entry against `MacOsMachOPatcher.cpp`; relinker build and ctest are green on Linux (the Windows test is registered only for WIN32, so the full Windows Build covers it). Merging once that passes.
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!5990
No description provided.