test(libSceAjmi): load the batch alias modules without preloading the unpatched ones #24115

Merged
Romannachwievor merged 1 commit from upstream-pr/24115 into main 2026-11-20 10:58:03 +00:00
Romannachwievor commented 2026-11-20 06:37:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Romannachwievor on 2026-11-20T06:37:56Z.


Title: test(libSceAjmi): load the batch alias modules without preloading the unpatched ones

What

Since #21533 the nid variants of guest_ajmi_batch_inline, guest_ajmi_batch_run, guest_ajmi_batch_control and guest_ajmi_batch_split abort on macOS:

dlopen(.../guest_ajmi_batch_alias_modules/libSceAjmi.prx): Symbol not found: _NVDXiUesSbA
  Referenced from: .../guest_ajmi_batch_alias_modules/libSceAjmi.prx
  Expected in:     .../core/libs/libs/unpatched/libSceAjm.native.prx

guest_ajmi_batch_aliases_tests links libSceAjmi and libc, but it never calls either of them: it only takes decltype of the exports and loads the modules with dlopen. On macOS ld64 keeps both as load commands, so the unpatched libSceAjmi.prx, libSceAjm.native.prx, libkernel.prx and libc.prx are already loaded through @rpath when the test starts. dyld then resolves the @rpath/libSceAjm.native.prx dependency of the patched alias module to the unpatched image that is already loaded (DYLD_PRINT_SEARCHING shows found: already-loaded-by-rpath), instead of the patched copy next to it. The unpatched copy exports sceAjmBatchCancel rather than NVDXiUesSbA, so the bind fails. Before #21533 libSceAjmi did not depend on libSceAjm.native, so the stale binding was never hit. On Linux the link drops unused libraries, so nothing is preloaded there.

Linking only libc is not enough. Then the patched libkernel.prx in the alias directory binds its libc imports against the unpatched libc.prx that the test still preloads (Symbol not found: _H480xkq8iKk). This change links the test the way guest_ajmi_lifecycle_aliases_tests, guest_ajmi_parser_aliases_tests and guest_ajmi_submission_tests already are: ${CMAKE_DL_LIBS} everywhere, plus libc on Windows only. Each variant then loads a consistent set of modules from its own directory.

Tested

macOS 26.5, Apple M1, x86_64 Release under Rosetta 2, on main a4d1053d4b plus #17425 and #11049.

  • Before: the four guest_ajmi_batch_*_nid tests fail with the error above, and the four _unpatched ones pass.
  • After: ctest -R '^guest_ajmi_batch_(inline|run|control|split)_(nid|unpatched)$' passes 8 of 8, three runs in a row. ctest -R '^guest_ajmi' passes 27 of 27.
  • otool -L on the test binary now lists no .prx.
  • python3 tools/check_conventions.py --base origin/main passes on this branch.
  • Linux x86_64, Ubuntu 24.04, GCC 13.3 (Docker Offload, 16 CPUs), main 240d7aa391 and this branch: ctest -R '^guest_ajmi' passes 27 of 27 on both, three runs each.
  • Not tested: Windows.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5408986718 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24115). Originally posted by [Romannachwievor](https://github.com/Romannachwievor) on 2026-11-20T06:37:56Z. --- Title: test(libSceAjmi): load the batch alias modules without preloading the unpatched ones ### What Since #21533 the `nid` variants of `guest_ajmi_batch_inline`, `guest_ajmi_batch_run`, `guest_ajmi_batch_control` and `guest_ajmi_batch_split` abort on macOS: ``` dlopen(.../guest_ajmi_batch_alias_modules/libSceAjmi.prx): Symbol not found: _NVDXiUesSbA Referenced from: .../guest_ajmi_batch_alias_modules/libSceAjmi.prx Expected in: .../core/libs/libs/unpatched/libSceAjm.native.prx ``` `guest_ajmi_batch_aliases_tests` links `libSceAjmi` and `libc`, but it never calls either of them: it only takes `decltype` of the exports and loads the modules with `dlopen`. On macOS ld64 keeps both as load commands, so the unpatched `libSceAjmi.prx`, `libSceAjm.native.prx`, `libkernel.prx` and `libc.prx` are already loaded through `@rpath` when the test starts. dyld then resolves the `@rpath/libSceAjm.native.prx` dependency of the patched alias module to the unpatched image that is already loaded (`DYLD_PRINT_SEARCHING` shows `found: already-loaded-by-rpath`), instead of the patched copy next to it. The unpatched copy exports `sceAjmBatchCancel` rather than `NVDXiUesSbA`, so the bind fails. Before #21533 `libSceAjmi` did not depend on `libSceAjm.native`, so the stale binding was never hit. On Linux the link drops unused libraries, so nothing is preloaded there. Linking only `libc` is not enough. Then the patched `libkernel.prx` in the alias directory binds its libc imports against the unpatched `libc.prx` that the test still preloads (`Symbol not found: _H480xkq8iKk`). This change links the test the way `guest_ajmi_lifecycle_aliases_tests`, `guest_ajmi_parser_aliases_tests` and `guest_ajmi_submission_tests` already are: `${CMAKE_DL_LIBS}` everywhere, plus `libc` on Windows only. Each variant then loads a consistent set of modules from its own directory. ### Tested macOS 26.5, Apple M1, x86_64 Release under Rosetta 2, on main `a4d1053d4b` plus #17425 and #11049. - Before: the four `guest_ajmi_batch_*_nid` tests fail with the error above, and the four `_unpatched` ones pass. - After: `ctest -R '^guest_ajmi_batch_(inline|run|control|split)_(nid|unpatched)$'` passes 8 of 8, three runs in a row. `ctest -R '^guest_ajmi'` passes 27 of 27. - `otool -L` on the test binary now lists no `.prx`. - `python3 tools/check_conventions.py --base origin/main` passes on this branch. - Linux x86_64, Ubuntu 24.04, GCC 13.3 (Docker Offload, 16 CPUs), main `240d7aa391` and this branch: `ctest -R '^guest_ajmi'` passes 27 of 27 on both, three runs each. - Not tested: Windows. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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 AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-11-20 06:50:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T06:50:28Z.

Review: APPROVED


Reviewed — looks good

The change aligns the batch alias test’s link dependencies with the existing AJMI alias tests; I found no blocking defects in the reviewed source.

What I ran

Reviewed head 6c37c330f9ba73722ac915b3d53907fccb75c810. I read the prepared description, commit summary, manifest and diff, then inspected the changed CMake context and the three referenced alias-test CMake files through repo_read.py. I did not run build or test commands.

Results

Check Result Note
Diff and source review passed One CMake file reviewed
Build and tests not run No local execution

Findings

Blocking

None.

Non-blocking

None.

Not verified

The report’s macOS and Linux test results were author-reported and not independently run. Windows behavior was not tested. The only changed file, core/libs/prx/libSceAjmi/CMakeLists.txt, was read in full; no files were excluded by the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5988637279 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24115#pullrequestreview-5988637279). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T06:50:28Z. **Review:** APPROVED --- # Reviewed — looks good The change aligns the batch alias test’s link dependencies with the existing AJMI alias tests; I found no blocking defects in the reviewed source. ## What I ran Reviewed head `6c37c330f9ba73722ac915b3d53907fccb75c810`. I read the prepared description, commit summary, manifest and diff, then inspected the changed CMake context and the three referenced alias-test CMake files through `repo_read.py`. I did not run build or test commands. ## Results | Check | Result | Note | |---|---|---| | Diff and source review | passed | One CMake file reviewed | | Build and tests | not run | No local execution | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The report’s macOS and Linux test results were author-reported and not independently run. Windows behavior was not tested. The only changed file, `core/libs/prx/libSceAjmi/CMakeLists.txt`, was read in full; no files were excluded by the manifest. ## To get this to a good state Nothing is required.
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!24115
No description provided.