Skip to content

test(libSceAjmi): find the unpatched alias module on macOS - #19689

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
Alexius0815:contrib/macos-ajmi-alias-dyld-fallback
Nov 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
Alexius0815:contrib/macos-ajmi-alias-dyld-fallback

Conversation

@Alexius0815

Copy link
Copy Markdown
Contributor

What

On macOS guest_ajmi_batch_inline_unpatched and guest_ajmi_batch_run_unpatched (added in #16283) abort at line 58: Ajmi batch alias check failed at line 58: 4MsUK9kAnKg_nid_no_patch_cut (and m0xisYC6U2w_nid_no_patch_cut for run).

The tests prepend the alias module directory to DYLD_LIBRARY_PATH. dyld searches DYLD_LIBRARY_PATH by leaf name before the path passed to dlopen, so the unpatched variant opens guest_ajmi_batch_alias_modules/libSceAjmi.prx instead of libs/unpatched/libSceAjmi.prx, and dlsym does not find the _cut export there. DYLD_PRINT_LIBRARIES=1 shows the alias copy being loaded for the unpatched path.

The macOS branch now uses DYLD_FALLBACK_LIBRARY_PATH, so dyld tries the explicit dlopen path before the fallback directory list. The change is limited to the Apple CTest environment.

Tested

macOS 27.2, Apple M4 (MacBook Air), x86-64 Release under Rosetta 2, on main 117ff62d9b plus the open macOS build pull requests of our test stack (#11437, #11049, #17425, #16796, #18139, #17878, #17879). CTest, one test at a time:

  • Without this change: guest_ajmi_batch_inline_unpatched and guest_ajmi_batch_run_unpatched abort at line 58; the _nid variants pass.
  • With it: all four guest_ajmi_batch_* tests pass.
  • A separate x86-64 dlopen/dlsym probe reproduced the missing inline export with the alias directory in DYLD_LIBRARY_PATH. With the same directories in DYLD_FALLBACK_LIBRARY_PATH, it resolved the symbol from the unpatched PRX.

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 known
  • GPUs tested: n/a
  • AI-assisted: yes

On macOS the four guest_ajmi_batch tests prepended the alias module
directory to DYLD_LIBRARY_PATH. dyld searches DYLD_LIBRARY_PATH by leaf
name before the path given to dlopen, so the unpatched variants opened
the copy in guest_ajmi_batch_alias_modules instead of
libs/unpatched/libSceAjmi.prx, dlsym found no
4MsUK9kAnKg_nid_no_patch_cut and m0xisYC6U2w_nid_no_patch_cut there,
and both unpatched tests aborted at line 58.

DYLD_FALLBACK_LIBRARY_PATH is only searched after the given path and
the install names fail, which matches what LD_LIBRARY_PATH does for a
dlopen path that contains a slash on Linux.
@JJenkx

JJenkx commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Windows check of head f1f62bdfc6, merged onto main 19b5d78fff (merge 474bea0822). Setup: Windows 11 Enterprise 22621, MinGW-w64 GCC 15.2 UCRT, Release.

guest_ajmi_batch_inline_unpatched, guest_ajmi_batch_run_unpatched, guest_ajmi_batch_inline_nid and guest_ajmi_batch_run_nid passed in 3 of 3 runs, 0 skipped.

AI-assisted: yes.

@oneandonlydean
oneandonlydean merged commit 5e58891 into boykopovar:main Nov 14, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants