fix(relinker): resolve versioned Mono module dependency #13143

Merged
kyon-eth merged 5 commits from upstream-pr/13143 into main 2026-11-02 17:27:06 +00:00
kyon-eth commented 2026-10-30 04:13:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kyon-eth on 2026-10-30T04:13:48Z.


What

Resolve an import qualified as libmonosgen to the declared libmonosgen-2.0.prx dependency. Without this mapping, the relinker does not associate the import with that versioned dependency.

The observed module and dependency identities record the matching dependency and module names in two version-labelled images (SHA-256 52e4ef63044494ed966e27f2d103f9a75235ac247a41b814bb67edfa527a03e8). The labels do not authenticate retail firmware provenance. Other Mono version numbers retain their existing behavior.

The overlap checker could not compare the shared CMake file against #5021, #9793 and #10792 because those branches conflict with main. Their added CMake lines do not define this test target.

Tested

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

  • The mapping applies only in the observed direction; a regression case verifies that importing the physical provider name does not select the logical-name library. The updated macOS guest-reader test passes.

  • macOS x86-64: built and ran import_module, including the guest image reader, the matching dependency, an unrelated version and ambiguous dependency rejection.

  • Audited conventions, whitespace and open PR overlap.

  • No Linux, Windows, console or game run was performed.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5079360921 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13143). Originally posted by [kyon-eth](https://github.com/kyon-eth) on 2026-10-30T04:13:48Z. --- ### What Resolve an import qualified as `libmonosgen` to the declared `libmonosgen-2.0.prx` dependency. Without this mapping, the relinker does not associate the import with that versioned dependency. The [observed module and dependency identities](https://gist.github.com/kyon-eth/c507a78ff96bd0d56c5da803c1f9a0f6/a7dc25f8b75374933bc07599bc8cc25e6df7edc2) record the matching dependency and module names in two version-labelled images (SHA-256 `52e4ef63044494ed966e27f2d103f9a75235ac247a41b814bb67edfa527a03e8`). The labels do not authenticate retail firmware provenance. Other Mono version numbers retain their existing behavior. The overlap checker could not compare the shared CMake file against #5021, #9793 and #10792 because those branches conflict with main. Their added CMake lines do not define this test target. ### Tested - Preserves the existing normalized-dependency match before trying the new alias; the guest-reader test includes a regression for a `-module` dependency. - The mapping applies only in the observed direction; a regression case verifies that importing the physical provider name does not select the logical-name library. The updated macOS guest-reader test passes. - macOS x86-64: built and ran `import_module`, including the guest image reader, the matching dependency, an unrelated version and ambiguous dependency rejection. - Audited conventions, whitespace and open PR overlap. - No Linux, Windows, console or game run was performed. ### 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](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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
CnRJay commented 2026-11-01 19:51:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:51:17Z.

Review: COMMENTED


Correction (2026-11-01): the title-ID/log demand below is not a CONTRIBUTING requirement; Unblocks: none is allowed. The technical points below are unaffected.

  1. Name-by-name alias in the matcher. The fix is normalized == "libmonosgen" ? "libmonosgen-2_0" : normalized inside the dependency lookup. The next PRs in this series (#13472, #13473, #13475, #13477, #13482, #13486) each rewrite the same function to add one more hard-coded pair (libSceLibreSSl3, libSceLibreSSL, ...). That is a growing list of module names seen in particular images, written as if branches, not a rule for how the console's loader maps an import-module name to a dependency. What is the general rule (the loader's actual comparison, e.g. case folding or stripping the version suffix) and can the lookup implement that once? If it is not known, a data table with its source recorded in docs/dev/debt is better than a code branch per name.

  2. No title. "Unblocks" gives no title ID or log line showing an import of libmonosgen failing to resolve on main. The evidence is a gist about two image labels the body itself says do not authenticate provenance.

  3. Which dependency wins. The old loop threw when two dependencies had the same normalized name. In the new findMatch(lookup) the alias is tried only after the direct match fails. If an image lists both a module that normalizes to libmonosgen and libmonosgen-2.0.prx, the direct match wins and the other is never considered, so the ambiguity check no longer fires for that pair. Please add a test with both present and say which one is expected to bind.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729928321 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13143#pullrequestreview-5729928321). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:51:17Z. **Review:** COMMENTED --- **Correction (2026-11-01):** the title-ID/log demand below is not a CONTRIBUTING requirement; `Unblocks: none` is allowed. The technical points below are unaffected. 1. **Name-by-name alias in the matcher.** The fix is `normalized == "libmonosgen" ? "libmonosgen-2_0" : normalized` inside the dependency lookup. The next PRs in this series (#13472, #13473, #13475, #13477, #13482, #13486) each rewrite the same function to add one more hard-coded pair (`libSceLibreSSl3`, `libSceLibreSSL`, ...). That is a growing list of module names seen in particular images, written as `if` branches, not a rule for how the console's loader maps an import-module name to a dependency. What is the general rule (the loader's actual comparison, e.g. case folding or stripping the version suffix) and can the lookup implement that once? If it is not known, a data table with its source recorded in `docs/dev/debt` is better than a code branch per name. 2. **No title.** "Unblocks" gives no title ID or log line showing an import of `libmonosgen` failing to resolve on main. The evidence is a gist about two image labels the body itself says do not authenticate provenance. 3. **Which dependency wins.** The old loop threw when two dependencies had the same normalized name. In the new `findMatch(lookup)` the alias is tried only after the direct match fails. If an image lists both a module that normalizes to `libmonosgen` and `libmonosgen-2.0.prx`, the direct match wins and the other is never considered, so the ambiguity check no longer fires for that pair. Please add a test with both present and say which one is expected to bind.
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!13143
No description provided.