feat(libSceLibcInternal): implement the empty deleting destructors #16009

Merged
edubox merged 3 commits from upstream-pr/16009 into main 2026-11-09 01:15:45 +00:00
edubox commented 2026-11-05 09:19:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-11-05T09:19:01Z.


What

Six libSceLibcInternal deleting destructors threw. In firmware 11.00 (system/common/lib/libSceLibcInternal.sprx) each one destroys an empty object and calls the guest operator delete; none of them has any other effect. This change does the same through _ZdlPv_nid_postfix:

Export NID
_ZNSt7codecvtIwc9_MbstatetED0Ev 9BI3oYkCTCU
_ZNSt8messagesIcED0Ev jy9urODH0Wo
_ZNSt8messagesIwED0Ev gMwkpZNI9Us
_ZNSt8money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev qkl3Siab04M
_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev 6yplvTHbxpE
_ZNSt24_Iostream_error_categoryD0Ev jVwxMhFRw8Q

The six bodies in the module are push %rbp; mov %rsp,%rbp; call 0xb1e10; pop %rbp; ret, where 0xb1e10 is _ZdlPv. The matching D1 destructors return without touching the object, so the deleting destructor is just the free. The exports keep their helper names in core/libs/prx/libSceLibcInternal/InventoryExports6.cpp; the library exports the same NIDs as on main.

docs/dev/debt/libSceLibcInternal.md: the six per-function "signature and behavior are unverified" entries are removed because their gaps are closed. No new debt entry is needed: the 11.00 module settles the body and the mangled name settles the void(void*) signature.

Tested

Linux x86-64, GCC 16.2.1, Release, origin/main 6d173c1a197.

  • New core/libs/tests/GuestLibcInternalDeletingDestructors.cpp registers a host allocation table through ApplicationHeapRegister_nid_no_patch, allocates each object with the guest _Znwm_nid_postfix, and asserts that each deleting destructor calls the registered free exactly once on that object.
  • guest_libc_internal_deleting_destructors and guest_libc_internal_{aligned_new,exception_destructors,mtx,pad} plus guest_init_once pass.
  • No title or homebrew exercises these exports.
  • tools/check_conventions.py --base origin/main: passed.
  • tools/pr_overlap.py --branch feat/libcint-deleting-destructors --jobs 32: no open pull request implements the same exports. The reported file overlap comes from the stub-renaming pull request declared as the dependency below and from pull requests that already conflict with main.

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: #15678
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5169089474 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16009). Originally posted by [edubox](https://github.com/edubox) on 2026-11-05T09:19:01Z. --- ### What Six `libSceLibcInternal` deleting destructors threw. In firmware 11.00 (`system/common/lib/libSceLibcInternal.sprx`) each one destroys an empty object and calls the guest `operator delete`; none of them has any other effect. This change does the same through `_ZdlPv_nid_postfix`: | Export | NID | | --- | --- | | `_ZNSt7codecvtIwc9_MbstatetED0Ev` | `9BI3oYkCTCU` | | `_ZNSt8messagesIcED0Ev` | `jy9urODH0Wo` | | `_ZNSt8messagesIwED0Ev` | `gMwkpZNI9Us` | | `_ZNSt8money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev` | `qkl3Siab04M` | | `_ZNSt8time_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED0Ev` | `6yplvTHbxpE` | | `_ZNSt24_Iostream_error_categoryD0Ev` | `jVwxMhFRw8Q` | The six bodies in the module are `push %rbp; mov %rsp,%rbp; call 0xb1e10; pop %rbp; ret`, where `0xb1e10` is `_ZdlPv`. The matching `D1` destructors return without touching the object, so the deleting destructor is just the free. The exports keep their helper names in `core/libs/prx/libSceLibcInternal/InventoryExports6.cpp`; the library exports the same NIDs as on `main`. `docs/dev/debt/libSceLibcInternal.md`: the six per-function "signature and behavior are unverified" entries are removed because their gaps are closed. No new debt entry is needed: the 11.00 module settles the body and the mangled name settles the `void(void*)` signature. ### Tested Linux x86-64, GCC 16.2.1, Release, `origin/main` `6d173c1a197`. - New `core/libs/tests/GuestLibcInternalDeletingDestructors.cpp` registers a host allocation table through `ApplicationHeapRegister_nid_no_patch`, allocates each object with the guest `_Znwm_nid_postfix`, and asserts that each deleting destructor calls the registered free exactly once on that object. - `guest_libc_internal_deleting_destructors` and `guest_libc_internal_{aligned_new,exception_destructors,mtx,pad}` plus `guest_init_once` pass. - No title or homebrew exercises these exports. - `tools/check_conventions.py --base origin/main`: passed. - `tools/pr_overlap.py --branch feat/libcint-deleting-destructors --jobs 32`: no open pull request implements the same exports. The reported file overlap comes from the stub-renaming pull request declared as the dependency below and from pull requests that already conflict with `main`. ### 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 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: #15678 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!16009
No description provided.