refactor(ajm): drop duplicated stub exports from libSceAjm and libSceAjmi #228

Merged
adriadam10 merged 1 commit from upstream-pr/228 into main 2026-10-02 07:35:05 +00:00
adriadam10 commented 2026-10-01 17:21:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-01T17:21:45Z.


What

libSceAjm and libSceAjmi only exported NotImplemented stubs of 13 functions that libSceAjm.native already implements (Export.cpp and src/Ajm.cpp). As suggested in review, both Export.cpp now contain only APS5_DUMMY_FUN, like libkernel_sys, so there are no duplicate exports between the libraries and titles bind to the implementation in libSceAjm.native.

No title found that loads libSceAjm without libSceAjm.native.

Tested

Linux (CachyOS, GCC): Release build, ninja libs (NID patching OK) and full ctest pass. nm -D on libSceAjm.prx and libSceAjmi.prx shows only DummyFunction_nid_no_patch. Windows only through CI. No title tested.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4707140530 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/228). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-01T17:21:45Z. --- ### What `libSceAjm` and `libSceAjmi` only exported `NotImplemented` stubs of 13 functions that `libSceAjm.native` already implements (`Export.cpp` and `src/Ajm.cpp`). As suggested in review, both `Export.cpp` now contain only `APS5_DUMMY_FUN`, like `libkernel_sys`, so there are no duplicate exports between the libraries and titles bind to the implementation in `libSceAjm.native`. No title found that loads `libSceAjm` without `libSceAjm.native`. ### Tested Linux (CachyOS, GCC): Release build, `ninja libs` (NID patching OK) and full `ctest` pass. `nm -D` on `libSceAjm.prx` and `libSceAjmi.prx` shows only `DummyFunction_nid_no_patch`. Windows only through CI. No title tested. ### 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) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-01 17:22:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-01T17:22:07Z.


Progress report (c00bc19 → 14e1321)

📈 System libraries: 78.87% (+0.68%, -26 removed functions)

🗑️ 26 removed
Library Name
libSceAjm sceAjmBatchCancel
libSceAjm sceAjmBatchErrorDump
libSceAjm sceAjmBatchWait
libSceAjm sceAjmDecAt9ParseConfigData
libSceAjm sceAjmFinalize
libSceAjm sceAjmInitialize
libSceAjm sceAjmInstanceCreate
libSceAjm sceAjmInstanceDestroy
libSceAjm sceAjmMemoryRegister
libSceAjm sceAjmMemoryUnregister
libSceAjm sceAjmModuleRegister
libSceAjm sceAjmModuleUnregister
libSceAjm sceAjmStrError
libSceAjmi sceAjmBatchCancel
libSceAjmi sceAjmBatchErrorDump
libSceAjmi sceAjmBatchWait
libSceAjmi sceAjmDecAt9ParseConfigData
libSceAjmi sceAjmFinalize
libSceAjmi sceAjmInitialize
libSceAjmi sceAjmInstanceCreate
libSceAjmi sceAjmInstanceDestroy
libSceAjmi sceAjmMemoryRegister
libSceAjmi sceAjmMemoryUnregister
libSceAjmi sceAjmModuleRegister
libSceAjmi sceAjmModuleUnregister
libSceAjmi sceAjmStrError
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5936734205 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/228#issuecomment-5936734205). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-01T17:22:07Z. --- <!-- progress-report --> ### Progress report (c00bc19 → 14e1321) 📈 **System libraries**: 78.87% (+0.68%, -26 removed functions) <details> <summary>🗑️ 26 removed</summary> | Library | Name | | - | - | | libSceAjm | `sceAjmBatchCancel` | | libSceAjm | `sceAjmBatchErrorDump` | | libSceAjm | `sceAjmBatchWait` | | libSceAjm | `sceAjmDecAt9ParseConfigData` | | libSceAjm | `sceAjmFinalize` | | libSceAjm | `sceAjmInitialize` | | libSceAjm | `sceAjmInstanceCreate` | | libSceAjm | `sceAjmInstanceDestroy` | | libSceAjm | `sceAjmMemoryRegister` | | libSceAjm | `sceAjmMemoryUnregister` | | libSceAjm | `sceAjmModuleRegister` | | libSceAjm | `sceAjmModuleUnregister` | | libSceAjm | `sceAjmStrError` | | libSceAjmi | `sceAjmBatchCancel` | | libSceAjmi | `sceAjmBatchErrorDump` | | libSceAjmi | `sceAjmBatchWait` | | libSceAjmi | `sceAjmDecAt9ParseConfigData` | | libSceAjmi | `sceAjmFinalize` | | libSceAjmi | `sceAjmInitialize` | | libSceAjmi | `sceAjmInstanceCreate` | | libSceAjmi | `sceAjmInstanceDestroy` | | libSceAjmi | `sceAjmMemoryRegister` | | libSceAjmi | `sceAjmMemoryUnregister` | | libSceAjmi | `sceAjmModuleRegister` | | libSceAjmi | `sceAjmModuleUnregister` | | libSceAjmi | `sceAjmStrError` | </details>
boykopovar commented 2026-10-01 18:55:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-01T18:55:29Z.


Have you discovered that this is necessary for running any game? I'm just assuming that if a game imports libSceAjm, it also imports libSceAjm.native, and then the symbol will be found; you shouldn't add a copy of it to another library. In the case of Font, a game was indeed found that only loads one of them.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5938385789 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/228#issuecomment-5938385789). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-01T18:55:29Z. --- Have you discovered that this is necessary for running any game? I'm just assuming that if a game imports libSceAjm, it also imports libSceAjm.native, and then the symbol will be found; you shouldn't add a copy of it to another library. In the case of Font, a game was indeed found that only loads one of them.
adriadam10 commented 2026-10-01 19:17:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-01T19:17:03Z.


No, I haven't found a title that loads only libSceAjm; it came from the progress map. One thing I noticed: libSceAjm.prx and libSceAjmi.prx still export the same 13 symbols as NotImplemented stubs, and the relinked output has no symbol versioning, so on Linux a title listing libSceAjm before libSceAjm.native in DT_NEEDED would bind to the stub. If that matters, removing the duplicated stubs (instead of copying the implementation) would avoid it. Otherwise I'll close this one.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5938764110 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/228#issuecomment-5938764110). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-01T19:17:03Z. --- No, I haven't found a title that loads only libSceAjm; it came from the progress map. One thing I noticed: libSceAjm.prx and libSceAjmi.prx still export the same 13 symbols as NotImplemented stubs, and the relinked output has no symbol versioning, so on Linux a title listing libSceAjm before libSceAjm.native in DT_NEEDED would bind to the stub. If that matters, removing the duplicated stubs (instead of copying the implementation) would avoid it. Otherwise I'll close this one.
boykopovar commented 2026-10-02 07:11:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by boykopovar on 2026-10-02T07:11:51Z.


If a library exports as stubs only functions that are already implemented in another library, then follow the example of libkernel_sys:

#include <cstdint>
#include <cstddef>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"

extern "C" {

APS5_DUMMY_FUN

}

Then we won't have duplicate exports between libraries.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5947184573 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/228#issuecomment-5947184573). Originally posted by [boykopovar](https://github.com/boykopovar) on 2026-10-02T07:11:51Z. --- If a library exports as stubs only functions that are already implemented in another library, then follow the example of libkernel_sys: ```c++ #include <cstdint> #include <cstddef> #include "SceTypes.hpp" #include "prx/libc/include/General.hpp" extern "C" { APS5_DUMMY_FUN } ``` Then we won't have duplicate exports between libraries.
adriadam10 commented 2026-10-02 07:17:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-02T07:17:26Z.


Done: both Export.cpp are now APS5_DUMMY_FUN only, like libkernel_sys; the shared cmake and the test are gone.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:5947245311 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/228#issuecomment-5947245311). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-02T07:17:26Z. --- Done: both `Export.cpp` are now `APS5_DUMMY_FUN` only, like `libkernel_sys`; the shared cmake and the test are gone.
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!228
No description provided.