fix(relinker): record declared host imports in guest registries #5598

Merged
JJenkx merged 7 commits from upstream-pr/5598 into main 2026-10-15 11:59:00 +00:00
JJenkx commented 2026-10-14 00:49:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-14T00:49:42Z.


What

Bundled-module registries omit imports with a declared host owner, hiding missing system-library support from import audits. Record those imports with their library and relocation target. Keep actual guest bindings out of the host registry and omit R_X86_64_NONE relocations. Binding selection and generated module images are unchanged.

Tested

  • Full standalone Linux/Windows fork CI passes head 4414bca7217d, containing main feddf7f4c654: Linux 1,043 passed / 46 skipped; Windows 720 passed / 389 skipped. All Linux, Windows and macOS relinker jobs pass. Expected skips remain unvalidated.
  • The regression fails before the production change because a declared-host module has an empty registry instead of its GLOB_DAT and JUMP_SLOT entries. Six output scenarios cover Linux, Windows and macOS conversion, with actual guest owners and declared host owners shadowed by unrelated guest exports of the same NID. Host bindings preserve owner/target offsets; guest bindings and no-op relocations are excluded.
  • An earlier Astro Bot PPSA21564 audit exposes 364 previously omitted declared-host relocation references across five bundled modules (250 distinct NID/library pairs). Converted executable/module bytes stay identical. These are newly visible audit references, not newly implemented APIs or standalone game-startup evidence.
  • Moved the debt entry away from the independent startup and alias entries. The selected peer branches merge cleanly, and this head also merges cleanly with main ce5c8395333. CI above remains tied to its recorded source/base. Conventions and whitespace checks pass.
  • An earlier Linux attempt at head 426eef946f9 aborted in guest_ampr_threads; its failed job passed on retry. That scheduling remains unisolated. Separate stack-retirement work is #5597; this registry change does not require it.

Checklist

  • Based on main; current mergeability and tested revisions recorded above
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • No silent stubs added
  • No notes, investigation files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none; import-audit completeness
  • GPUs tested: n/a; relinker registry output
  • AI-assisted: yes

Latest conflict refresh

Published head 48685f40e1ff769f4fbbe46d63d0170fcbf680ee contains main c9ee728a7c4086060efaf2f9e256ef2fbc4e2de5. The sole conflict was an additive debt entry in docs/dev/debt/relinker.md; both the guest-import registry note and main's Windows fixed-base note are preserved. Source files merge cleanly. The relinker-only Release build passes, all 158 relinker checks pass with no skips, and conventions/whitespace checks pass. Fresh full-platform CI now passes at the head/base recorded below; earlier results retain their original scope.

Verified fresh full CI

Workflow 38516673708 now passes topic 48685f40e1ff769f4fbbe46d63d0170fcbf680ee on base c9ee728a7c4086060efaf2f9e256ef2fbc4e2de5. Linux: 1062 passed/46 expected skips of 1108; Windows: 733 passed/398 expected skips of 1131. Relinker jobs also pass without skips on Linux (158), Windows (153) and macOS (149). Head/base pins are verified in every job log. Skipped cases remain unvalidated. The branch merges cleanly into the recorded main; this confirms the debt-conflict refresh and source merge, without a title-progression claim.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4851376204 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5598). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-10-14T00:49:42Z. --- ### What Bundled-module registries omit imports with a declared host owner, hiding missing system-library support from import audits. Record those imports with their library and relocation target. Keep actual guest bindings out of the host registry and omit R_X86_64_NONE relocations. Binding selection and generated module images are unchanged. ### Tested - [Full standalone Linux/Windows fork CI](https://github.com/JJenkx/AnyPS5/actions/runs/38491402918) passes head `4414bca7217d`, containing main `feddf7f4c654`: Linux 1,043 passed / 46 skipped; Windows 720 passed / 389 skipped. All Linux, Windows and macOS relinker jobs pass. Expected skips remain unvalidated. - The regression fails before the production change because a declared-host module has an empty registry instead of its GLOB_DAT and JUMP_SLOT entries. Six output scenarios cover Linux, Windows and macOS conversion, with actual guest owners and declared host owners shadowed by unrelated guest exports of the same NID. Host bindings preserve owner/target offsets; guest bindings and no-op relocations are excluded. - An earlier Astro Bot PPSA21564 audit exposes 364 previously omitted declared-host relocation references across five bundled modules (250 distinct NID/library pairs). Converted executable/module bytes stay identical. These are newly visible audit references, not newly implemented APIs or standalone game-startup evidence. - Moved the debt entry away from the independent startup and alias entries. The selected peer branches merge cleanly, and this head also merges cleanly with main `ce5c8395333`. CI above remains tied to its recorded source/base. Conventions and whitespace checks pass. - An earlier Linux attempt at head `426eef946f9` aborted in `guest_ampr_threads`; its failed job passed on retry. That scheduling remains unisolated. Separate stack-retirement work is #5597; this registry change does not require it. ### Checklist - [x] Based on main; current mergeability and tested revisions recorded above - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] No silent stubs added - [x] No notes, investigation files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none; import-audit completeness - [x] GPUs tested: n/a; relinker registry output - [x] AI-assisted: yes ### Latest conflict refresh Published head `48685f40e1ff769f4fbbe46d63d0170fcbf680ee` contains main `c9ee728a7c4086060efaf2f9e256ef2fbc4e2de5`. The sole conflict was an additive debt entry in `docs/dev/debt/relinker.md`; both the guest-import registry note and main's Windows fixed-base note are preserved. Source files merge cleanly. The relinker-only Release build passes, all 158 relinker checks pass with no skips, and conventions/whitespace checks pass. Fresh full-platform CI now passes at the head/base recorded below; earlier results retain their original scope. ### Verified fresh full CI [Workflow 38516673708](https://github.com/JJenkx/AnyPS5/actions/runs/38516673708) now passes topic `48685f40e1ff769f4fbbe46d63d0170fcbf680ee` on base `c9ee728a7c4086060efaf2f9e256ef2fbc4e2de5`. Linux: 1062 passed/46 expected skips of 1108; Windows: 733 passed/398 expected skips of 1131. Relinker jobs also pass without skips on Linux (158), Windows (153) and macOS (149). Head/base pins are verified in every job log. Skipped cases remain unvalidated. The branch merges cleanly into the recorded main; this confirms the debt-conflict refresh and source merge, without a title-progression claim.
adriadam10 commented 2026-10-15 11:32:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:32:32Z.


Checked the registry change in GuestModuleBuilder.cpp (declared-host imports recorded, R_X86_64_NONE skipped; systemImports is only read for the registry, so bindings are untouched). guest_registry passes on the merged tree and fails without the production change; relinker ctest 132/132, no skips; relinker CI green on Linux, Windows and macOS. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191054440 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5598#issuecomment-6191054440). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T11:32:32Z. --- Checked the registry change in `GuestModuleBuilder.cpp` (declared-host imports recorded, `R_X86_64_NONE` skipped; `systemImports` is only read for the registry, so bindings are untouched). `guest_registry` passes on the merged tree and fails without the production change; relinker ctest 132/132, no skips; relinker CI green on Linux, Windows and macOS. Merging.
github-actions[bot] commented 2026-10-15 11:56:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T11:56:41Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#6327 docs/dev/debt/relinker.md L8
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6191470904 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5598#issuecomment-6191470904). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T11:56:41Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #6327 | `docs/dev/debt/relinker.md` [L8](https://github.com/boykopovar/AnyPS5/blob/23dcb824991938a90591efb2b3229eede0cd79b0/docs/dev/debt/relinker.md#L8) | | |
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!5598
No description provided.