feat(libc): export the __sce_v2 _Xbad_function_call and sized aligned delete #1120

Merged
TideOPL merged 2 commits from upstream-pr/1120 into main 2026-10-08 07:40:21 +00:00
TideOPL commented 2026-10-07 13:13:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-07T13:13:49Z.


What

PPSA16064 (Minecraft Dungeons II) ships its own libc.prx, which imports two C++ runtime symbols from libSceLibcInternal that no host library exported, so the title failed to load:

  • std::__sce_v2::_Xbad_function_call() (_ZNSt8__sce_v219_Xbad_function_callEv), the inline-namespace spelling of the existing std::_Xbad_function_call. It throws std::bad_function_call the same way.
  • operator delete(void*, std::size_t, std::align_val_t) (_ZdlPvmSt11align_val_t), the sized form of the existing aligned delete. It frees the same way and ignores the size.

Tested

  • Windows 11, NVIDIA GeForce RTX 5070, MinGW-w64 GCC 15.2.0 (WinLibs UCRT r7). Full ctest: 393/393.
  • application_heap_default: frees an aligned block through the sized form and checks that a null pointer frees nothing.
  • exception_runtime (Linux only): checks that the new thrower throws std::bad_function_call. Run on Ubuntu 24.04 (WSL), GCC 13.3: passes, and fails if the thrower is changed to throw std::bad_alloc. The application_heap tests pass there too.
  • PPSA16064: the title's libc loads.

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:4773170122 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1120). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-07T13:13:49Z. --- ### What PPSA16064 (Minecraft Dungeons II) ships its own `libc.prx`, which imports two C++ runtime symbols from libSceLibcInternal that no host library exported, so the title failed to load: - `std::__sce_v2::_Xbad_function_call()` (`_ZNSt8__sce_v219_Xbad_function_callEv`), the inline-namespace spelling of the existing `std::_Xbad_function_call`. It throws `std::bad_function_call` the same way. - `operator delete(void*, std::size_t, std::align_val_t)` (`_ZdlPvmSt11align_val_t`), the sized form of the existing aligned delete. It frees the same way and ignores the size. ### Tested - Windows 11, NVIDIA GeForce RTX 5070, MinGW-w64 GCC 15.2.0 (WinLibs UCRT r7). Full `ctest`: 393/393. - `application_heap_default`: frees an aligned block through the sized form and checks that a null pointer frees nothing. - `exception_runtime` (Linux only): checks that the new thrower throws `std::bad_function_call`. Run on Ubuntu 24.04 (WSL), GCC 13.3: passes, and fails if the thrower is changed to throw `std::bad_alloc`. The `application_heap` tests pass there too. - PPSA16064: the title's libc loads. ### Checklist - [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-07 14:33:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T14:33:35Z.


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
#1143 core/libs/prx/libc/src/exception/StandardExceptions.cpp L291
core/libs/tests/ExceptionRuntime.cpp L7, L20-21
#1240 core/libs/prx/libc/src/exception/StandardExceptions.cpp L291
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6040210284 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1120#issuecomment-6040210284). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-07T14:33:35Z. --- <!-- 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 | |---|---|---|---| | #1143 | `core/libs/prx/libc/src/exception/StandardExceptions.cpp` [L291](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/core/libs/prx/libc/src/exception/StandardExceptions.cpp#L291)<br>`core/libs/tests/ExceptionRuntime.cpp` [L7](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/core/libs/tests/ExceptionRuntime.cpp#L7), [L20-21](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/core/libs/tests/ExceptionRuntime.cpp#L20-L21) | | | | #1240 | `core/libs/prx/libc/src/exception/StandardExceptions.cpp` [L291](https://github.com/boykopovar/AnyPS5/blob/df16c4c256be3c44e03eb9149a6ce5f8e8a038b2/core/libs/prx/libc/src/exception/StandardExceptions.cpp#L291) | | |
github-actions[bot] commented 2026-10-08 04:36:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-08T04:36:36Z.


Progress report (1e5bb88 → 88e7422)

📈 System libraries: 86.14% (+0.01%, +2 implemented functions)

✅ 2 implemented
Library Name
libc _ZNSt8__sce_v219_Xbad_function_callEv_nid_postfix
libc _ZdlPvmSt11align_val_t_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6052342564 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1120#issuecomment-6052342564). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-08T04:36:36Z. --- <!-- progress-report --> ### Progress report (1e5bb88 → 88e7422) 📈 **System libraries**: 86.14% (+0.01%, +2 implemented functions) <details> <summary>✅ 2 implemented</summary> | Library | Name | | - | - | | libc | `_ZNSt8__sce_v219_Xbad_function_callEv_nid_postfix` | | libc | `_ZdlPvmSt11align_val_t_nid_postfix` | </details>
adriadam10 commented 2026-10-08 07:40:17 +00:00 (Migrated from github.com)

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


Checked build + full ctest (423/423) on current main, CI green on the head. Both NIDs match aerolib (_ZNSt8__sce_v219_Xbad_function_callEv, _ZdlPvmSt11align_val_t), the thrower reuses the existing bad_function_call vtable, and the sized delete frees like the aligned one. Without the change the new tests don't link. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6055117343 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/1120#issuecomment-6055117343). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-08T07:40:17Z. --- Checked build + full ctest (423/423) on current main, CI green on the head. Both NIDs match aerolib (`_ZNSt8__sce_v219_Xbad_function_callEv`, `_ZdlPvmSt11align_val_t`), the thrower reuses the existing `bad_function_call` vtable, and the sized delete frees like the aligned one. Without the change the new tests don't link. Merging.
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!1120
No description provided.