fix(relinker): resolve internal libc imports from guest libc #1454

Merged
mrk1987 merged 2 commits from upstream-pr/1454 into main 2026-10-08 14:07:34 +00:00
mrk1987 commented 2026-10-08 07:23:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mrk1987 on 2026-10-08T07:23:25Z.


What

Windows import resolution for libSceLibcInternal.prx searches native internal/libc providers but omits the title's bundled guest libc.prx. SDK C++ namespace exports supplied by that runtime therefore remain unresolved.

Append the existing converted guest libc provider after native providers for internal-libc imports. This uses a real exported implementation: if all providers lack the symbol, startup still fails with the unresolved-import diagnostic. Other libraries retain their existing module scope.

Tested

Windows, MinGW-w64, Release relinker build on upstream main 6b573862. Three tests pass: windows_import_modules, guest_module_directories, and tls_function_coverage.

The import test adds execution cases for guest-only resolution, native internal-libc priority, native libc priority, and an absent symbol that still fails startup. Existing module-scope and missing-dependency cases also pass. tools/check_conventions.py and git diff --check pass.

This resolved an SDK C++ import during local startup testing with a retail title. No playable-game claim. No experimental NP exports or game files are included.

The test additions are positioned separately from #1153; git merge-tree --write-tree confirms a clean merge with its current head. The relevant test and conventions checks pass after relocating the additions.

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; no silent stubs added
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes (OpenAI Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4783351765 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1454). Originally posted by [mrk1987](https://github.com/mrk1987) on 2026-10-08T07:23:25Z. --- ### What Windows import resolution for `libSceLibcInternal.prx` searches native internal/libc providers but omits the title's bundled guest `libc.prx`. SDK C++ namespace exports supplied by that runtime therefore remain unresolved. Append the existing converted guest libc provider after native providers for internal-libc imports. This uses a real exported implementation: if all providers lack the symbol, startup still fails with the unresolved-import diagnostic. Other libraries retain their existing module scope. ### Tested Windows, MinGW-w64, Release relinker build on upstream main `6b573862`. Three tests pass: `windows_import_modules`, `guest_module_directories`, and `tls_function_coverage`. The import test adds execution cases for guest-only resolution, native internal-libc priority, native libc priority, and an absent symbol that still fails startup. Existing module-scope and missing-dependency cases also pass. `tools/check_conventions.py` and `git diff --check` pass. This resolved an SDK C++ import during local startup testing with a retail title. No playable-game claim. No experimental NP exports or game files are included. The test additions are positioned separately from #1153; `git merge-tree --write-tree` confirms a clean merge with its current head. The relevant test and conventions checks pass after relocating the additions. ### 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; no silent stubs added - [x] No notes, investigation files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes (OpenAI Codex)
adriadam10 commented 2026-10-08 14:07:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T14:07:30Z.


Checked build + full ctest on Linux merged onto current main (459/459), and the diff against the description: the guest libc.prx provider is appended after the native providers only for libSceLibcInternal.prx imports, so native priority is unchanged and an absent symbol still fails startup.
The new cases only execute on Windows (os.name == 'nt'), so the windows CI job is what covers them; merging once it is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6061670754 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1454#issuecomment-6061670754). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T14:07:30Z. --- Checked build + full ctest on Linux merged onto current main (459/459), and the diff against the description: the guest `libc.prx` provider is appended after the native providers only for `libSceLibcInternal.prx` imports, so native priority is unchanged and an absent symbol still fails startup. The new cases only execute on Windows (`os.name == 'nt'`), so the `windows` CI job is what covers them; merging once it is green.
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!1454
No description provided.