feat(libSceLibcInternal): run the _Pad complete-object destructor #14666

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

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


What

Implements XyJPhPqpzMw (_ZNSt4_PadD1Ev) in libSceLibcInternal, which threw NotImplemented.

_Pad has no virtual bases, so under the Itanium C++ ABI its complete-object destructor (D1) does the same work as the base-object one (D2). The export runs the existing libc export _ZNSt4_PadD2Ev, which unlocks and destroys the pad's mutex and condition and throws from a thread that does not hold the mutex. The stub and its stub entry are removed, and a debt entry records what is unverified: the console's libSceLibcInternal.sprx was not read and no title was seen calling it.

The old stub name sceLibcInternalUnknown6_081_XyJPhPqpzMw_nid_no_patch is retired intentionally. The replacement keeps the same NID XyJPhPqpzMw; the ABI audit's export-removed warning refers to the old C symbol, not a removed guest export.

Tested

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

  • tools/check_conventions.py --base origin/main passes.
  • New guest_libc_internal_pad: after the libc C2 constructor, the destructor releases the mutex and condition and leaves the other members alone; a destroyed pad can be constructed again; destroying it twice and a null pad throw. It passes, together with guest_libc_threads, guest_libc_internal_aligned_new, guest_libc_internal_mtx, guest_init_once and guest_locale.
  • The patched libSceLibcInternal.prx exports the NID 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:5109541969 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14666). Originally posted by [miguelcoxcaballero](https://github.com/miguelcoxcaballero) on 2026-11-01T16:59:01Z. --- ### What Implements `XyJPhPqpzMw` (`_ZNSt4_PadD1Ev`) in `libSceLibcInternal`, which threw `NotImplemented`. `_Pad` has no virtual bases, so under the [Itanium C++ ABI](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#definitions) its complete-object destructor (`D1`) does the same work as the base-object one (`D2`). The export runs the existing `libc` export `_ZNSt4_PadD2Ev`, which unlocks and destroys the pad's mutex and condition and throws from a thread that does not hold the mutex. The stub and its stub entry are removed, and a debt entry records what is unverified: the console's `libSceLibcInternal.sprx` was not read and no title was seen calling it. The old stub name `sceLibcInternalUnknown6_081_XyJPhPqpzMw_nid_no_patch` is retired intentionally. The replacement keeps the same NID `XyJPhPqpzMw`; the ABI audit's `export-removed` warning refers to the old C symbol, not a removed guest export. ### Tested Ubuntu 24.04, GCC, Release, `BUILD_TESTING=ON`, full build: - `tools/check_conventions.py --base origin/main` passes. - New `guest_libc_internal_pad`: after the `libc` `C2` constructor, the destructor releases the mutex and condition and leaves the other members alone; a destroyed pad can be constructed again; destroying it twice and a null pad throw. It passes, together with `guest_libc_threads`, `guest_libc_internal_aligned_new`, `guest_libc_internal_mtx`, `guest_init_once` and `guest_locale`. - The patched `libSceLibcInternal.prx` exports the NID 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:50 +00:00 (Migrated from github.com)

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

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:5729920317 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14666#pullrequestreview-5729920317). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-11-01T19:48:50Z. **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 20:53:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T20:53:45Z.

Review: COMMENTED


Reviewed — no blocking findings

The change implements the complete-object destructor _ZNSt4_PadD1Ev (NID XyJPhPqpzMw) by calling the existing base-object destructor export. The NID matches the mangled name under the repo's own NID tool, and the new guest test passed in the hosted Windows CTest run at this head. The ABI audit reports one removed export, the old stub name, which keeps the same NID. Approval waits for the macOS relinker jobs, which were queued at review time.

What I ran

  • Head 73c844be0bd73ec5580ef3b9558010804e98ff6a; base f2d874c1fdccf781c0fa5d86619bb5dd8894b958. 6 files, +76/-7: libSceLibcInternal/Pad.cpp (new), CMakeLists.txt, InventoryExports6.cpp (stub removed), include/Api.hpp, tests/GuestLibcInternalPad.cpp (new), and docs/dev/debt/libSceLibcInternal.md.
  • NID: python3 -c with tools/nid_names.py compute_nid('_ZNSt4_PadD1Ev') returns XyJPhPqpzMw, and _ZNSt4_PadD2Ev returns gjLRZgfb3i0. The inventory cited in the debt entry lists _ZNSt4_PadD1Ev (6 matches in the fetched file).
  • The base-object export _ZNSt4_PadD2Ev_nid_postfix exists (core/libs/prx/libc/src/Threads.cpp line 497) and is declared in libc/include/Api.hpp line 1116.
  • Read the new Pad.cpp, the test's main, the removed stub, and the debt diff.
  • ABI audit (manual run): status passed_with_warnings, 240 symbols; one finding, export-removed, for sceLibcInternalUnknown6_081_XyJPhPqpzMw_nid_no_patch. That is the stub replaced in this PR, and its NID is 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 (the manual run above replaces it).
  • Hosted: the windows CTest run passed 2595 of 2595 cases, including guest_libc_internal_pad.
  • 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
NID of _ZNSt4_PadD1Ev passed computed with tools/nid_names.py: XyJPhPqpzMw
Base-object export it calls passed _ZNSt4_PadD2Ev_nid_postfix exists in libc
Removed stub and NID passed the stub is replaced by an export with the same NID (ABI audit warning)
New guest test (hosted) passed guest_libc_internal_pad passed in the windows CTest run
Behaviour of D2 (unlock, destroy, throw) not traced the claim in the debt entry was not read in Threads.cpp
Console behaviour not verified the debt entry says the console library was not read
Build and runtime tests (Linux) not run the hosted windows run covers the test; no local build
Negative controls not run no build here
Hosted CI not complete windows passed; the macOS relinker jobs were queued; linux, register-context and write-watch skipped
Commands and unedited precheck output

Commands:

  • Precheck: python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14666 --output-dir <scratch>/precheck/14666p (report.md in that directory).
  • Head fetched by URL (objects only): git fetch https://github.com/boykopovar/AnyPS5.git pull/14666/head.
  • Manual ABI run: python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 73c844be0bd73ec5580ef3b9558010804e98ff6a --json.
  • NID check: tools/nid_names.py compute_nid on _ZNSt4_PadD1Ev and _ZNSt4_PadD2Ev.
  • Hosted checks: gh api repos/boykopovar/AnyPS5/commits/73c844be0bd73ec5580ef3b9558010804e98ff6a/check-runs; the windows job's CTest summary shows 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...73c844be0bd73ec5580ef3b9558010804e98ff6a
conventions_and_pr_template passed /marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 73c844be0bd73ec5580ef3b9558010804e98ff6a --title feat(libSceLibcInternal): run the _Pad complete-object destructor --body /dev/shm/reviewer-run/precheck/14666p/pr-body.md
changed_export_abi_audit failed /marc/DeusMachina_0x1914/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 73c844be0bd73ec5580ef3b9558010804e98ff6a --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 14666 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14666p/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/14666p/head-73c844be0bd7-85c2e16f/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14666p/head-73c844be0bd7-85c2e16f --json core/libs/prx/libSceLibcInternal/CMakeLists.txt core/libs/prx/libSceLibcInternal/InventoryExports6.cpp core/libs/prx/libSceLibcInternal/Pad.cpp core/libs/prx/libSceLibcInternal/include/Api.hpp core/libs/tests/GuestLibcInternalPad.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 export-removed warning for sceLibcInternalUnknown6_081_XyJPhPqpzMw_nid_no_patch is expected for this change, since the NID is kept. Please say in the PR body that the stub name is retired on purpose.

Sources

Not verified

  • The D2 behaviour (unlock, destroy, throw) was not traced in Threads.cpp.
  • The console's libSceLibcInternal was not read, as the debt entry itself 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. The optional note in the PR body is above.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5730220736 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14666#pullrequestreview-5730220736). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-01T20:53:45Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The change implements the complete-object destructor `_ZNSt4_PadD1Ev` (NID `XyJPhPqpzMw`) by calling the existing base-object destructor export. The NID matches the mangled name under the repo's own NID tool, and the new guest test passed in the hosted Windows CTest run at this head. The ABI audit reports one removed export, the old stub name, which keeps the same NID. Approval waits for the macOS relinker jobs, which were queued at review time. ## What I ran - Head `73c844be0bd73ec5580ef3b9558010804e98ff6a`; base `f2d874c1fdccf781c0fa5d86619bb5dd8894b958`. 6 files, +76/-7: `libSceLibcInternal/Pad.cpp` (new), `CMakeLists.txt`, `InventoryExports6.cpp` (stub removed), `include/Api.hpp`, `tests/GuestLibcInternalPad.cpp` (new), and `docs/dev/debt/libSceLibcInternal.md`. - NID: `python3 -c` with `tools/nid_names.py` `compute_nid('_ZNSt4_PadD1Ev')` returns `XyJPhPqpzMw`, and `_ZNSt4_PadD2Ev` returns `gjLRZgfb3i0`. The inventory cited in the debt entry lists `_ZNSt4_PadD1Ev` (6 matches in the fetched file). - The base-object export `_ZNSt4_PadD2Ev_nid_postfix` exists (`core/libs/prx/libc/src/Threads.cpp` line 497) and is declared in `libc/include/Api.hpp` line 1116. - Read the new `Pad.cpp`, the test's `main`, the removed stub, and the debt diff. - ABI audit (manual run): status `passed_with_warnings`, 240 symbols; one finding, `export-removed`, for `sceLibcInternalUnknown6_081_XyJPhPqpzMw_nid_no_patch`. That is the stub replaced in this PR, and its NID is 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 (the manual run above replaces it). - Hosted: the windows CTest run passed 2595 of 2595 cases, including `guest_libc_internal_pad`. - 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 | | NID of `_ZNSt4_PadD1Ev` | passed | computed with `tools/nid_names.py`: `XyJPhPqpzMw` | | Base-object export it calls | passed | `_ZNSt4_PadD2Ev_nid_postfix` exists in `libc` | | Removed stub and NID | passed | the stub is replaced by an export with the same NID (ABI audit warning) | | New guest test (hosted) | passed | `guest_libc_internal_pad` passed in the windows CTest run | | Behaviour of `D2` (unlock, destroy, throw) | not traced | the claim in the debt entry was not read in `Threads.cpp` | | Console behaviour | not verified | the debt entry says the console library was not read | | Build and runtime tests (Linux) | not run | the hosted windows run covers the test; no local build | | Negative controls | not run | no build here | | Hosted CI | not complete | windows passed; the macOS relinker jobs were 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 14666 --output-dir <scratch>/precheck/14666p` (report.md in that directory). - Head fetched by URL (objects only): `git fetch https://github.com/boykopovar/AnyPS5.git pull/14666/head`. - Manual ABI run: `python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 73c844be0bd73ec5580ef3b9558010804e98ff6a --json`. - NID check: `tools/nid_names.py` `compute_nid` on `_ZNSt4_PadD1Ev` and `_ZNSt4_PadD2Ev`. - Hosted checks: `gh api repos/boykopovar/AnyPS5/commits/73c844be0bd73ec5580ef3b9558010804e98ff6a/check-runs`; the windows job's CTest summary shows `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...73c844be0bd73ec5580ef3b9558010804e98ff6a` | | conventions_and_pr_template | passed | `/marc/DeusMachina_0x1914/.venv/bin/python3 tools/check_conventions.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 73c844be0bd73ec5580ef3b9558010804e98ff6a --title feat(libSceLibcInternal): run the _Pad complete-object destructor --body /dev/shm/reviewer-run/precheck/14666p/pr-body.md` | | changed_export_abi_audit | failed | `/marc/DeusMachina_0x1914/.venv/bin/python3 tools/pr_abi_audit.py --base f2d874c1fdccf781c0fa5d86619bb5dd8894b958 --head 73c844be0bd73ec5580ef3b9558010804e98ff6a --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 14666 --repo boykopovar/AnyPS5 --output-dir /dev/shm/reviewer-run/precheck/14666p/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/14666p/head-73c844be0bd7-85c2e16f/tools/pr_test_quality.py --root /dev/shm/reviewer-run/precheck/14666p/head-73c844be0bd7-85c2e16f --json core/libs/prx/libSceLibcInternal/CMakeLists.txt core/libs/prx/libSceLibcInternal/InventoryExports6.cpp core/libs/prx/libSceLibcInternal/Pad.cpp core/libs/prx/libSceLibcInternal/include/Api.hpp core/libs/tests/GuestLibcInternalPad.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 `export-removed` warning for `sceLibcInternalUnknown6_081_XyJPhPqpzMw_nid_no_patch` is expected for this change, since the NID is kept. Please say in the PR body that the stub name is retired on purpose. ## Sources - New export: https://github.com/boykopovar/AnyPS5/blob/73c844be0bd73ec5580ef3b9558010804e98ff6a/core/libs/prx/libSceLibcInternal/Pad.cpp - New test: https://github.com/boykopovar/AnyPS5/blob/73c844be0bd73ec5580ef3b9558010804e98ff6a/core/libs/tests/GuestLibcInternalPad.cpp - Base-object export: https://github.com/boykopovar/AnyPS5/blob/73c844be0bd73ec5580ef3b9558010804e98ff6a/core/libs/prx/libc/src/Threads.cpp#L497 - Debt entry: https://github.com/boykopovar/AnyPS5/blob/73c844be0bd73ec5580ef3b9558010804e98ff6a/docs/dev/debt/libSceLibcInternal.md ## Not verified - The `D2` behaviour (unlock, destroy, throw) was not traced in `Threads.cpp`. - The console's `libSceLibcInternal` was not read, as the debt entry itself 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. The optional note in the PR body is above.
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!14666
No description provided.