fix(relinker): match AJM import module to native provider #13477

Closed
kyon-eth wants to merge 12 commits from upstream-pr/13477 into main
kyon-eth commented 2026-10-30 16:34:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kyon-eth on 2026-10-30T16:34:29Z.


What

Match imports qualified as libSceAjm to their declared libSceAjm.native.prx dependency when no exact libSceAjm.prx dependency is present. Exact dependencies still take precedence, unrelated versions remain distinct, and ambiguous alias matches fail.

The two names occur together in both version-labelled inventories and their imported NIDs match the declared provider. The labels do not authenticate firmware provenance. No title unblock is claimed.

This branch builds on #13143, #13472, #13473 and #13475 and includes their commits. It must be rebased after those prerequisites land.

Tested

  • Preserves the existing normalized-dependency match before trying the new alias; the guest-reader test includes a regression for a -module dependency.

  • The updated mapping is one-way: the observed logical name can match its declared provider, but an import of the provider name is not redirected back to the logical-name library. A regression test covers the reverse case.

  • macOS x86-64: built and ran relinker-only import_module_tests, including the guest image reader, exact-dependency precedence, version separation and ambiguity rejection.

  • A focused probe fails on the #13475 base and passes with this change. Conventions and diff whitespace checks pass.

  • The overlap checker could not compare the parent CMake changes with #5021, #7173, #7531, #9793, #10792, #10861, #11628, #11661, #11689 and #11698 because those branches conflict with main. Their CMake diffs do not reference the new test target. The overlap checklist remains unchecked pending complete comparison.

  • No Linux, Windows, console or title run; no full product build.

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: #13143, #13472, #13473, #13475
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5087703460 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13477). Originally posted by [kyon-eth](https://github.com/kyon-eth) on 2026-10-30T16:34:29Z. --- ### What Match imports qualified as `libSceAjm` to their declared `libSceAjm.native.prx` dependency when no exact `libSceAjm.prx` dependency is present. Exact dependencies still take precedence, unrelated versions remain distinct, and ambiguous alias matches fail. The two names occur together in both version-labelled inventories and their imported NIDs match the declared provider. The labels do not authenticate firmware provenance. No title unblock is claimed. This branch builds on #13143, #13472, #13473 and #13475 and includes their commits. It must be rebased after those prerequisites land. ### Tested - Preserves the existing normalized-dependency match before trying the new alias; the guest-reader test includes a regression for a `-module` dependency. - The updated mapping is one-way: the observed logical name can match its declared provider, but an import of the provider name is not redirected back to the logical-name library. A regression test covers the reverse case. - macOS x86-64: built and ran relinker-only `import_module_tests`, including the guest image reader, exact-dependency precedence, version separation and ambiguity rejection. - A focused probe fails on the #13475 base and passes with this change. Conventions and diff whitespace checks pass. - The overlap checker could not compare the parent CMake changes with #5021, #7173, #7531, #9793, #10792, #10861, #11628, #11661, #11689 and #11698 because those branches conflict with main. Their CMake diffs do not reference the new test target. The overlap checklist remains unchecked pending complete comparison. - No Linux, Windows, console or title run; no full product build. ### Checklist - [ ] 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: #13143, #13472, #13473, #13475 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-25 15:59:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T15:59:59Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; the implementation preserves exact dependency matches and tries the specific alias only when no normalized exact match exists.

What I ran

Reviewed head 0540d6a8068b270ee497cc3e547c55468175233d. No commands or tests were run; the console reader was used to inspect the prepared diff and relevant repository code.

Results

Check Result Note
Diff and changed code passed Both changed files read
Tests not run Only author-reported test results available

Findings

Blocking

None.

Non-blocking

None.

Sources

The changed mapping logic and its tests were read in core/relinker/domain/include/domain/ImportModule.hpp and core/relinker/relinker/tests/ImportModuleTests.cpp. Its caller in GuestImageReader.cpp was also inspected. Pinned implementation

Not verified

No local test or build was run. Cross-platform, console and title behavior remain unverified, as stated in the PR description. The two changed files marked for review were both read; no files were excluded by the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6060873311 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13477#pullrequestreview-6060873311). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-25T15:59:59Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; the implementation preserves exact dependency matches and tries the specific alias only when no normalized exact match exists. ## What I ran Reviewed head `0540d6a8068b270ee497cc3e547c55468175233d`. No commands or tests were run; the console reader was used to inspect the prepared diff and relevant repository code. ## Results | Check | Result | Note | |---|---|---| | Diff and changed code | passed | Both changed files read | | Tests | not run | Only author-reported test results available | ## Findings ### Blocking None. ### Non-blocking None. ## Sources The changed mapping logic and its tests were read in `core/relinker/domain/include/domain/ImportModule.hpp` and `core/relinker/relinker/tests/ImportModuleTests.cpp`. Its caller in `GuestImageReader.cpp` was also inspected. [Pinned implementation](https://github.com/boykopovar/AnyPS5/blob/0540d6a8068b270ee497cc3e547c55468175233d/core/relinker/domain/include/domain/ImportModule.hpp) ## Not verified No local test or build was run. Cross-platform, console and title behavior remain unverified, as stated in the PR description. The two changed files marked for review were both read; no files were excluded by the manifest. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 17:03:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T17:03:26Z.

Review: COMMENTED


The exact import_module CTest passed in a Linux relinker-only build. The AJM cases cover native provider selection, ambiguous native dependencies, and an explicitly native module name with only the legacy dependency present.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6174527529 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13477#pullrequestreview-6174527529). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T17:03:26Z. **Review:** COMMENTED --- The exact `import_module` CTest passed in a Linux relinker-only build. The AJM cases cover native provider selection, ambiguous native dependencies, and an explicitly native module name with only the legacy dependency present. AI-assisted: yes.

Pull request closed

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!13477
No description provided.