feat(libSceLibcInternal): run the base-object destructors of future_error, overflow_error and underflow_error #14659

Merged
miguelcoxcaballero merged 1 commit from upstream-pr/14659 into main 2026-11-02 22:41:15 +00:00
miguelcoxcaballero commented 2026-11-01 16:57:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by miguelcoxcaballero on 2026-11-01T16:57:32Z.


The three old stub C symbol names are retired intentionally. Each replacement keeps its original NID; the ABI audit's export-removed warnings refer to the old C symbols, not removed guest exports.

What

Implements three libSceLibcInternal exports that threw NotImplemented:

  • XFh0C66aEms (_ZNSt12future_errorD2Ev)
  • OypvNf3Uq3c (_ZNSt14overflow_errorD2Ev)
  • xiqd+QkuYXc (_ZNSt15underflow_errorD2Ev)

They are the base-object (D2) destructors of classes without virtual bases. The Itanium C++ ABI defines the complete-object destructor as the base-object one plus the virtual bases, so for these classes D1 and D2 do the same work. Each export runs the existing libc export of the D1 name (_ZNSt12future_errorD1Ev, _ZNSt14overflow_errorD1Ev, _ZNSt15underflow_errorD1Ev), the same way AlignedNew.cpp reuses libc (#14240). The three stubs, their declarations and their table rows are removed, and a debt entry records what is unverified: the console's libSceLibcInternal.sprx was not read and no title was seen calling them.

Tested

Ubuntu 24.04, GCC, Release, BUILD_TESTING=ON, full build:

  • tools/check_conventions.py --base origin/main passes.
  • New guest_libc_internal_exception_destructors: releases a runtime_error message through the overflow/underflow D2, resets inline and heap future_error messages (the heap one is freed once) and leaves the object as the libc D1 does. It passes, together with guest_libc_internal_aligned_new, guest_libc_internal_mtx, guest_init_once, guest_locale and guest_libc_threads.
  • The patched libSceLibcInternal.prx exports each of the three NIDs once.

Not tested on Windows, macOS or a PS5, nor with any title.

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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none (neighbouring lines of the same files as my three other libSceLibcInternal base-object PRs; the four branches merge together cleanly and build)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5109528120 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14659). Originally posted by [miguelcoxcaballero](https://github.com/miguelcoxcaballero) on 2026-11-01T16:57:32Z. --- The three old stub C symbol names are retired intentionally. Each replacement keeps its original NID; the ABI audit's `export-removed` warnings refer to the old C symbols, not removed guest exports. ### What Implements three `libSceLibcInternal` exports that threw `NotImplemented`: - `XFh0C66aEms` (`_ZNSt12future_errorD2Ev`) - `OypvNf3Uq3c` (`_ZNSt14overflow_errorD2Ev`) - `xiqd+QkuYXc` (`_ZNSt15underflow_errorD2Ev`) They are the base-object (`D2`) destructors of classes without virtual bases. The [Itanium C++ ABI](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#definitions) defines the complete-object destructor as the base-object one plus the virtual bases, so for these classes `D1` and `D2` do the same work. Each export runs the existing `libc` export of the `D1` name (`_ZNSt12future_errorD1Ev`, `_ZNSt14overflow_errorD1Ev`, `_ZNSt15underflow_errorD1Ev`), the same way `AlignedNew.cpp` reuses `libc` (#14240). The three stubs, their declarations and their table rows are removed, and a debt entry records what is unverified: the console's `libSceLibcInternal.sprx` was not read and no title was seen calling them. ### Tested Ubuntu 24.04, GCC, Release, `BUILD_TESTING=ON`, full build: - `tools/check_conventions.py --base origin/main` passes. - New `guest_libc_internal_exception_destructors`: releases a `runtime_error` message through the overflow/underflow `D2`, resets inline and heap `future_error` messages (the heap one is freed once) and leaves the object as the `libc` `D1` does. It passes, together with `guest_libc_internal_aligned_new`, `guest_libc_internal_mtx`, `guest_init_once`, `guest_locale` and `guest_libc_threads`. - The patched `libSceLibcInternal.prx` exports each of the three NIDs once. Not tested on Windows, macOS or a PS5, nor with any title. ### 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 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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none (neighbouring lines of the same files as my three other `libSceLibcInternal` base-object PRs; the four branches merge together cleanly and build) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
CnRJay commented 2026-11-01 19:48:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-11-01T19:48:47Z.

Review: COMMENTED


Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (Unblocks: none is allowed), and it contained no code review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5729920172 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14659#pullrequestreview-5729920172). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:48:47Z. **Review:** COMMENTED --- Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (`Unblocks: none` is allowed), and it contained no code review.
MarcZX10 commented 2026-11-01 21:22:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T21:22:03Z.

Review: COMMENTED


Reviewed — no blocking findings

Three inventory stubs become base-object destructors for future_error, overflow_error and underflow_error. Each NID matches the D2 name it implements under the repo's NID tool, and the code calls the complete-object D1 exports that libc defines (libc/src/exception/StandardExceptions.cpp and StandardExceptions.cpp line 751). The new guest test passed in the hosted Windows CTest run at this head (2595 of 2595 cases, including guest_libc_internal_exception_destructors). The ABI audit reports three removed stub names, each keeping its NID. Approval waits for the macOS relinker jobs, which were queued at review time.

What I ran

  • Head 8bb5e09df8eaf393dff7c732f591dddd26a24bf6; base f2d874c1fdccf781c0fa5d86619bb5dd8894b958. 7 files, +134/-21: ExceptionDestructors.cpp (new), CMakeLists.txt, InventoryExports.cpp (three stubs removed), include/Api.hpp, include/InventoryExports.hpp, tests/GuestLibcInternalExceptionDestructors.cpp (new) and docs/dev/debt/libSceLibcInternal.md.
  • NIDs with tools/nid_names.py: _ZNSt12future_errorD2Ev = XFh0C66aEms, _ZNSt14overflow_errorD2Ev = OypvNf3Uq3c, _ZNSt15underflow_errorD2Ev = xiqd+QkuYXc. These are the NIDs of the three new exports and of the three stubs they replace.
  • Callees: libc defines _ZNSt14overflow_errorD1Ev_nid_postfix and _ZNSt15underflow_errorD1Ev_nid_postfix (core/libs/prx/libc/src/exception/StandardExceptions.cpp lines 538 and 542) and _ZNSt12future_errorD1Ev_nid_postfix (line 751). The new exports call those names.
  • Manual ABI audit: passed_with_warnings, 392 symbols; three export-removed findings for libSceLibcInternalInventory_018, _044 and _051, each with its NID kept by the new export.
  • Precheck: diff check, conventions and PR template, and the live stack check passed; the ABI audit row failed on a missing helper (replaced by the manual run).
  • Hosted: the windows CTest run passed 2595 of 2595 cases, including guest_libc_internal_exception_destructors.
  • No MarcZX10 review at this head.

Results

Check Result Note
Diff check passed
Conventions and PR template passed precheck and hosted conventions passed
Mergeability and dependencies passed depends on none; the live stack check passed
NIDs of the three exports passed XFh0C66aEms, OypvNf3Uq3c, xiqd+QkuYXc match the D2 names
Callees defined in libc passed D1 exports defined in StandardExceptions.cpp
Removed stubs and NIDs passed same NIDs; ABI audit warnings expected
New guest test (hosted) passed guest_libc_internal_exception_destructors passed in the windows CTest run
Test assertions not traced the test file's assertions were not read line by line
Console behaviour not verified the debt entry says the console library was not read
Build and runtime tests (Linux) not run no local build
Negative controls not run no local build
Hosted CI not complete windows passed; macOS relinker jobs queued; linux, register-context and write-watch skipped
Commands and unedited precheck output

Commands:

  • Precheck: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14659 --output-dir <scratch>/precheck/14659p (report.md in that directory).
  • Head fetched by URL (objects only): git fetch https://github.com/boykopovar/AnyPS5.git pull/14659/head.
  • Manual ABI run: python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8bb5e09df8eaf393dff7c732f591dddd26a24bf6 --json.
  • NID check: tools/nid_names.py compute_nid on the six names above.
  • Hosted checks: gh api repos/boykopovar/AnyPS5/commits/8bb5e09df8eaf393dff7c732f591dddd26a24bf6/check-runs; Windows CTest: 100% tests passed, 0 tests failed out of 2595.

Precheck table (unedited):

Check Status Command / reason
build_and_compile not_applicable The precheck deliberately does not configure, build, or compile AnyPS5.
diff_check passed git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...8bb5e09df8eaf393dff7c732f591dddd26a24bf6
conventions_and_pr_template passed /marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8bb5e09df8eaf393dff7c732f591dddd26a24bf6 --title feat(libSceLibcInternal): run the base-object destructors of future_error, overflow_error and underflow_error --body /dev/shm/reviewer-run/precheck/14659p/pr-body.md
changed_export_abi_audit failed /marc/DeusMachina_0x1914/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8bb5e09df8eaf393dff7c732f591dddd26a24bf6 --json
python_syntax not_applicable No changed Python implementation files.
related_python_unit_tests not_applicable No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.
python_test_registration not_applicable No changed test_*.py files.
live_dependency_and_mergeability_check passed /marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14659 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14659p/stack
build_dependent_cpp_tests not_applicable Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.
test_quality_heuristics failed /marc/DeusMachina_0x1914/.venv/bin/python3 /dev/shm/reviewer-run/precheck/14659p/head-8bb5e09df8ea-5cd3eefe/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14659p/head-8bb5e09df8ea-5cd3eefe --json core/libs/prx/libSceLibcInternal/CMakeLists.txt core/libs/prx/libSceLibcInternal/ExceptionDestructors.cpp core/libs/prx/libSceLibcInternal/InventoryExports.cpp core/libs/prx/libSceLibcInternal/include/Api.hpp core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp core/libs/tests/GuestLibcInternalExceptionDestructors.cpp docs/dev/debt/libSceLibcInternal.md
negative_controls not_applicable No changed Python test module in tools/ can be run as a no-build base-source control.

Negative control

Not run here. The test needs a build of the Linux host.

Findings

Blocking

None.

Non-blocking

  • The ABI audit's three export-removed warnings are expected, since each NID is kept. Please say in the PR body that the stub names are retired on purpose.

Sources

Not verified

  • The test file's assertions were not read line by line; the hosted pass covers them.
  • The console's libSceLibcInternal was not read, as the debt entry says.
  • The macOS relinker jobs had not finished at review time.

To get this to a good state

  • Nothing blocking. Approval waits for the macOS relinker jobs on this head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5730331262 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14659#pullrequestreview-5730331262). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T21:22:03Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Three inventory stubs become base-object destructors for `future_error`, `overflow_error` and `underflow_error`. Each NID matches the `D2` name it implements under the repo's NID tool, and the code calls the complete-object `D1` exports that libc defines (`libc/src/exception/StandardExceptions.cpp` and `StandardExceptions.cpp` line 751). The new guest test passed in the hosted Windows CTest run at this head (2595 of 2595 cases, including `guest_libc_internal_exception_destructors`). The ABI audit reports three removed stub names, each keeping its NID. Approval waits for the macOS relinker jobs, which were queued at review time. ## What I ran - Head `8bb5e09df8eaf393dff7c732f591dddd26a24bf6`; base `f2d874c1fdccf781c0fa5d86619bb5dd8894b958`. 7 files, +134/-21: `ExceptionDestructors.cpp` (new), `CMakeLists.txt`, `InventoryExports.cpp` (three stubs removed), `include/Api.hpp`, `include/InventoryExports.hpp`, `tests/GuestLibcInternalExceptionDestructors.cpp` (new) and `docs/dev/debt/libSceLibcInternal.md`. - NIDs with `tools/nid_names.py`: `_ZNSt12future_errorD2Ev` = `XFh0C66aEms`, `_ZNSt14overflow_errorD2Ev` = `OypvNf3Uq3c`, `_ZNSt15underflow_errorD2Ev` = `xiqd+QkuYXc`. These are the NIDs of the three new exports and of the three stubs they replace. - Callees: libc defines `_ZNSt14overflow_errorD1Ev_nid_postfix` and `_ZNSt15underflow_errorD1Ev_nid_postfix` (`core/libs/prx/libc/src/exception/StandardExceptions.cpp` lines 538 and 542) and `_ZNSt12future_errorD1Ev_nid_postfix` (line 751). The new exports call those names. - Manual ABI audit: `passed_with_warnings`, 392 symbols; three `export-removed` findings for `libSceLibcInternalInventory_018`, `_044` and `_051`, each with its NID kept by the new export. - Precheck: diff check, conventions and PR template, and the live stack check passed; the ABI audit row failed on a missing helper (replaced by the manual run). - Hosted: the windows CTest run passed 2595 of 2595 cases, including `guest_libc_internal_exception_destructors`. - No MarcZX10 review at this head. ## Results | Check | Result | Note | | --- | --- | --- | | Diff check | passed | | | Conventions and PR template | passed | precheck and hosted conventions passed | | Mergeability and dependencies | passed | depends on none; the live stack check passed | | NIDs of the three exports | passed | `XFh0C66aEms`, `OypvNf3Uq3c`, `xiqd+QkuYXc` match the `D2` names | | Callees defined in libc | passed | `D1` exports defined in `StandardExceptions.cpp` | | Removed stubs and NIDs | passed | same NIDs; ABI audit warnings expected | | New guest test (hosted) | passed | `guest_libc_internal_exception_destructors` passed in the windows CTest run | | Test assertions | not traced | the test file's assertions were not read line by line | | Console behaviour | not verified | the debt entry says the console library was not read | | Build and runtime tests (Linux) | not run | no local build | | Negative controls | not run | no local build | | Hosted CI | not complete | windows passed; macOS relinker jobs queued; linux, register-context and write-watch skipped | <details><summary>Commands and unedited precheck output</summary> Commands: - Precheck: `python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14659 --output-dir <scratch>/precheck/14659p` (report.md in that directory). - Head fetched by URL (objects only): `git fetch https://github.com/boykopovar/AnyPS5.git pull/14659/head`. - Manual ABI run: `python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8bb5e09df8eaf393dff7c732f591dddd26a24bf6 --json`. - NID check: `tools/nid_names.py` `compute_nid` on the six names above. - Hosted checks: `gh api repos/boykopovar/AnyPS5/commits/8bb5e09df8eaf393dff7c732f591dddd26a24bf6/check-runs`; Windows CTest: `100% tests passed, 0 tests failed out of 2595`. Precheck table (unedited): | Check | Status | Command / reason | |---|---|---| | build_and_compile | not_applicable | `The precheck deliberately does not configure, build, or compile AnyPS5.` | | diff_check | passed | `git diff --check f2d874c1fdccf781c0fa5d86619bb5dd8894b958...8bb5e09df8eaf393dff7c732f591dddd26a24bf6` | | conventions_and_pr_template | passed | `/marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8bb5e09df8eaf393dff7c732f591dddd26a24bf6 --title feat(libSceLibcInternal): run the base-object destructors of future_error, overflow_error and underflow_error --body /dev/shm/reviewer-run/precheck/14659p/pr-body.md` | | changed_export_abi_audit | failed | `/marc/DeusMachina_0x1914/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 8bb5e09df8eaf393dff7c732f591dddd26a24bf6 --json` | | python_syntax | not_applicable | `No changed Python implementation files.` | | related_python_unit_tests | not_applicable | `No changed tools/ module has an existing sibling tools/tests/test_<module>.py suite.` | | python_test_registration | not_applicable | `No changed test_*.py files.` | | live_dependency_and_mergeability_check | passed | `/marc/DeusMachina_0x1914/.venv/bin/python3 /marc/AnyPS5/tools/pr_stack_check.py 14659 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14659p/stack` | | build_dependent_cpp_tests | not_applicable | `Not run: C++ tests need exact-head binaries, which require a build; the precheck does not build.` | | test_quality_heuristics | failed | `/marc/DeusMachina_0x1914/.venv/bin/python3 /dev/shm/reviewer-run/precheck/14659p/head-8bb5e09df8ea-5cd3eefe/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14659p/head-8bb5e09df8ea-5cd3eefe --json core/libs/prx/libSceLibcInternal/CMakeLists.txt core/libs/prx/libSceLibcInternal/ExceptionDestructors.cpp core/libs/prx/libSceLibcInternal/InventoryExports.cpp core/libs/prx/libSceLibcInternal/include/Api.hpp core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp core/libs/tests/GuestLibcInternalExceptionDestructors.cpp docs/dev/debt/libSceLibcInternal.md` | | negative_controls | not_applicable | `No changed Python test module in tools/ can be run as a no-build base-source control.` | </details> ## Negative control Not run here. The test needs a build of the Linux host. ## Findings **Blocking** None. **Non-blocking** - The ABI audit's three `export-removed` warnings are expected, since each NID is kept. Please say in the PR body that the stub names are retired on purpose. ## Sources - New exports: https://github.com/boykopovar/AnyPS5/blob/8bb5e09df8eaf393dff7c732f591dddd26a24bf6/core/libs/prx/libSceLibcInternal/ExceptionDestructors.cpp - New test: https://github.com/boykopovar/AnyPS5/blob/8bb5e09df8eaf393dff7c732f591dddd26a24bf6/core/libs/tests/GuestLibcInternalExceptionDestructors.cpp - libc callees: https://github.com/boykopovar/AnyPS5/blob/8bb5e09df8eaf393dff7c732f591dddd26a24bf6/core/libs/prx/libc/src/exception/StandardExceptions.cpp#L538-L542 and #L751 - Debt entry: https://github.com/boykopovar/AnyPS5/blob/8bb5e09df8eaf393dff7c732f591dddd26a24bf6/docs/dev/debt/libSceLibcInternal.md ## Not verified - The test file's assertions were not read line by line; the hosted pass covers them. - The console's `libSceLibcInternal` was not read, as the debt entry says. - The macOS relinker jobs had not finished at review time. ## To get this to a good state - Nothing blocking. Approval waits for the macOS relinker jobs on this head.
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!14659
No description provided.