feat(libSceLibcInternal): forward the numpunct<char> destructors to libc #27697

Open
berkay8987 wants to merge 1 commit from upstream-pr/27697 into main
berkay8987 commented 2026-11-27 02:34:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by berkay8987 on 2026-11-27T02:34:35Z.


What

libSceLibcInternal exported throwing stubs for the three numpunct<char> destructors: D1 qEob3o53s2M, D2 xFva4yxsVW8 and D0 Lf6h5krl2fA. libc implements those NIDs, so a title that imports them from libSceLibcInternal hit the stub. The complete and base object destructors now call libc's NumpunctDestroy, which runs _Tidy. The deleting destructor calls NumpunctDelete, which runs _Tidy and then operator delete. The pattern follows #24573, so the forwards cannot bind to themselves after NID patching. The debt entries move to a Functional entry that points at the libc limits.

Tested

Windows 11, MSYS2 UCRT64 GCC 16.2, Release. guest_libc_internal_deleting_destructors now builds a facet with libc and checks three things. D1 and D2 release its three strings and reject a null facet. D0 releases the strings and then the facet, and rejects a null facet. It passes. guest_libc_internal_libc_forwards also passes.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code


Readings taken: the libSceLibcInternal exports take the libc signatures and bodies for the same NIDs. Neither .sprx body was read. This branch and feat/libcinternal-numpunct-char-constructors add the same GuestLocale.hpp include to InventoryExports.hpp, so whichever merges second may need a trivial rebase.
Manual comparison, because pr_overlap.py failed closed on the shared inventory files: #13778, #18135, #19602 and #24880 do not touch these exports. #25573 deletes the InventoryExports.hpp declarations of inventory 161-167 without implementing those NIDs, so whichever merges second has a textual conflict in that header. #19864 adds lines to GuestLibcInternalDeletingDestructors.cpp next to this branch's test additions; the exports differ.

Summary by CodeRabbit

  • Bug Fixes
    • Improved compatibility for locale-related cleanup by correctly handling character-formatting facets across supported releases.
    • Fixed cases where destroying these facets could be unhandled, including when a facet is null.
    • Updated cleanup behavior to distinguish between destroying a facet and deleting it, helping applications that rely on locale formatting behave more consistently.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5520195911 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27697). Originally posted by [berkay8987](https://github.com/berkay8987) on 2026-11-27T02:34:35Z. --- ### What libSceLibcInternal exported throwing stubs for the three `numpunct<char>` destructors: D1 `qEob3o53s2M`, D2 `xFva4yxsVW8` and D0 `Lf6h5krl2fA`. libc implements those NIDs, so a title that imports them from libSceLibcInternal hit the stub. The complete and base object destructors now call libc's `NumpunctDestroy`, which runs `_Tidy`. The deleting destructor calls `NumpunctDelete`, which runs `_Tidy` and then `operator delete`. The pattern follows #24573, so the forwards cannot bind to themselves after NID patching. The debt entries move to a Functional entry that points at the libc limits. ### Tested Windows 11, MSYS2 UCRT64 GCC 16.2, Release. `guest_libc_internal_deleting_destructors` now builds a facet with libc and checks three things. D1 and D2 release its three strings and reject a null facet. D0 releases the strings and then the facet, and rejects a null facet. It passes. `guest_libc_internal_libc_forwards` also passes. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- Readings taken: the libSceLibcInternal exports take the libc signatures and bodies for the same NIDs. Neither `.sprx` body was read. This branch and `feat/libcinternal-numpunct-char-constructors` add the same `GuestLocale.hpp` include to `InventoryExports.hpp`, so whichever merges second may need a trivial rebase. Manual comparison, because `pr_overlap.py` failed closed on the shared inventory files: #13778, #18135, #19602 and #24880 do not touch these exports. #25573 deletes the `InventoryExports.hpp` declarations of inventory 161-167 without implementing those NIDs, so whichever merges second has a textual conflict in that header. #19864 adds lines to `GuestLibcInternalDeletingDestructors.cpp` next to this branch's test additions; the exports differ. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved compatibility for locale-related cleanup by correctly handling character-formatting facets across supported releases. * Fixed cases where destroying these facets could be unhandled, including when a facet is null. * Updated cleanup behavior to distinguish between destroying a facet and deleting it, helping applications that rely on locale formatting behave more consistently. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
JJenkx commented 2026-11-27 02:44:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-11-27T02:44:19Z.

Review: APPROVED


Reviewed the six-file diff at bc2308e0ba4a2fa9ebbc75e8f72044dbf81cc94d plus the existing libc helpers and test-registration context. No blocking findings in that scope.

The D1/D2 forwards call NumpunctDestroy_nid_no_patch; D0 calls NumpunctDelete_nid_no_patch, preserving the non-deleting/deleting distinction and avoiding a call through the patchable same-NID export names. The declarations keep APS5_VABI and the libc helper's pointer/void signature. The fixture checks the three string releases, the additional facet release for D0, and null rejection.

Independent Linux check: Linux7.3.5-arch1-1, GCC16.2.1, Release, SPIRV-Tools disabled. Exact PR head, separate checkout/build: guest_libc_internal_deleting_destructors and guest_libc_internal_libc_forwards both pass (2/2, zero skips). Loader traces initialize that build's raw libc, libkernel and libSceLibcInternal; source, provider and executable hashes stay unchanged. Conventions, debt-fragment validation and whitespace checks pass.

Commands, complete logs/JUnit, source identities and loader/hash receipts — 17 payloads; anonymous download and all payload hashes verified. Archive SHA-256 0bb15b593ac0ce595a87039c24eb5eb56c503bac63ab584555d36c8dca18194e.

This verifies the Linux host-side forwards and their existing fixture coverage. I did not inspect console .sprx bodies, run a patched title, independently repeat Windows testing, or measure performance. The inherited ABI/body and null-console-fault limitations remain as documented in the fragment.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6082801936 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27697#pullrequestreview-6082801936). Originally posted by [JJenkx](https://github.com/JJenkx) on 2026-11-27T02:44:19Z. **Review:** APPROVED --- Reviewed the six-file diff at `bc2308e0ba4a2fa9ebbc75e8f72044dbf81cc94d` plus the existing libc helpers and test-registration context. No blocking findings in that scope. The D1/D2 forwards call `NumpunctDestroy_nid_no_patch`; D0 calls `NumpunctDelete_nid_no_patch`, preserving the non-deleting/deleting distinction and avoiding a call through the patchable same-NID export names. The declarations keep `APS5_VABI` and the libc helper's pointer/void signature. The fixture checks the three string releases, the additional facet release for D0, and null rejection. **Independent Linux check:** Linux7.3.5-arch1-1, GCC16.2.1, Release, SPIRV-Tools disabled. Exact PR head, separate checkout/build: `guest_libc_internal_deleting_destructors` and `guest_libc_internal_libc_forwards` both pass (**2/2, zero skips**). Loader traces initialize that build's raw libc, libkernel and libSceLibcInternal; source, provider and executable hashes stay unchanged. Conventions, debt-fragment validation and whitespace checks pass. [Commands, complete logs/JUnit, source identities and loader/hash receipts](https://github.com/JJenkx/AnyPS5/releases/download/linux-validation-20261122/pr27697-linux-review-bc2308e0-20261127.tar.gz) — 17 payloads; anonymous download and all payload hashes verified. Archive SHA-256 `0bb15b593ac0ce595a87039c24eb5eb56c503bac63ab584555d36c8dca18194e`. This verifies the Linux host-side forwards and their existing fixture coverage. I did not inspect console `.sprx` bodies, run a patched title, independently repeat Windows testing, or measure performance. The inherited ABI/body and null-console-fault limitations remain as documented in the fragment. AI-assisted: yes.
MarcZX10 commented 2026-11-27 02:53:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T02:53:16Z.

Review: APPROVED


Reviewed — looks good

Nothing blocks this change; it forwards the three destructor exports to the corresponding libc implementations and updates declarations and regression coverage.

What I ran

Inspected the prepared diff and all six changed files at head bc2308e0ba4a2fa9ebbc75e8f72044dbf81cc94d, plus the libc destructor implementations and NumpunctFacet definition using repo_read.py. No build or tests were run; the test results in the PR description are author-reported.

Results

Check Result Note
Changed-file review passed All six changed files read
Targeted libc context passed Destroy and delete implementations read
Build and tests not run PR description reports Windows test runs

Findings

Blocking

None.

Non-blocking

None.

Not verified

Did not run the reported Windows build or tests. Did not inspect either console .sprx destructor body, so equivalence with libc behavior on console remains unverified. The bundle's files.json was not available; the manifest lists six changed files, and all six were read. No excluded files were identified in the available bundle listing.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6082860667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27697#pullrequestreview-6082860667). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-27T02:53:16Z. **Review:** APPROVED --- # Reviewed — looks good Nothing blocks this change; it forwards the three destructor exports to the corresponding libc implementations and updates declarations and regression coverage. ## What I ran Inspected the prepared diff and all six changed files at head `bc2308e0ba4a2fa9ebbc75e8f72044dbf81cc94d`, plus the libc destructor implementations and `NumpunctFacet` definition using `repo_read.py`. No build or tests were run; the test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Changed-file review | passed | All six changed files read | | Targeted libc context | passed | Destroy and delete implementations read | | Build and tests | not run | PR description reports Windows test runs | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Did not run the reported Windows build or tests. Did not inspect either console `.sprx` destructor body, so equivalence with libc behavior on console remains unverified. The bundle's `files.json` was not available; the manifest lists six changed files, and all six were read. No excluded files were identified in the available bundle listing. ## To get this to a good state Nothing is required.
Plyxen commented 2026-11-27 03:40:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Plyxen on 2026-11-27T03:40:15Z.

Review: APPROVED


Checked head bc2308e0ba, applied alone to main ad7582bad4. On Windows 11 with WinLibs GCC 15.2 (Release), tools/check_conventions.py --head and tools/debt_fold.py --check passed, the build succeeded, and all 4,930 CPU tests passed (I left out the GPU tests).

guest_libc_internal_deleting_destructors passed. On main the three exports throw through NotImplemented_nid_no_patch, so the new checks can't pass there.

tools/nid_names.py gives qEob3o53s2M for _ZNSt8numpunctIcED1Ev, xFva4yxsVW8 for D2 and Lf6h5krl2fA for D0. libc already exports xFva4yxsVW8 as NumpunctDestroy_nid_no_patch and Lf6h5krl2fA as NumpunctDelete_nid_no_patch (LocaleSupport.cpp:2465, :2471). So the complete-object and base-object destructors both run NumpunctDestroy, and the deleting one runs NumpunctDelete, which is right for a class without virtual bases. The test checks that three frees happen (grouping and the two bool names), plus the object for D0, and that a null facet throws. The debt entry says the libSceLibcInternal.sprx bodies were not read.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6083144169 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27697#pullrequestreview-6083144169). Originally posted by [Plyxen](https://github.com/Plyxen) on 2026-11-27T03:40:15Z. **Review:** APPROVED --- Checked head `bc2308e0ba`, applied alone to `main` `ad7582bad4`. On Windows 11 with WinLibs GCC 15.2 (Release), `tools/check_conventions.py --head` and `tools/debt_fold.py --check` passed, the build succeeded, and all 4,930 CPU tests passed (I left out the GPU tests). `guest_libc_internal_deleting_destructors` passed. On `main` the three exports throw through `NotImplemented_nid_no_patch`, so the new checks can't pass there. `tools/nid_names.py` gives `qEob3o53s2M` for `_ZNSt8numpunctIcED1Ev`, `xFva4yxsVW8` for `D2` and `Lf6h5krl2fA` for `D0`. libc already exports `xFva4yxsVW8` as `NumpunctDestroy_nid_no_patch` and `Lf6h5krl2fA` as `NumpunctDelete_nid_no_patch` (`LocaleSupport.cpp:2465`, `:2471`). So the complete-object and base-object destructors both run `NumpunctDestroy`, and the deleting one runs `NumpunctDelete`, which is right for a class without virtual bases. The test checks that three frees happen (grouping and the two bool names), plus the object for `D0`, and that a null facet throws. The debt entry says the `libSceLibcInternal.sprx` bodies were not read. AI-assisted: yes (Claude Code)
ligmaSec commented 2026-12-03 09:58:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T09:58:05Z.

Review: COMMENTED


The GuestLibcInternalDeletingDestructors fixture passed on Linux with the exact changed sources. The fixture verifies cleanup of the three facet-owned strings, facet deletion and null-argument handling.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6167465462 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27697#pullrequestreview-6167465462). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T09:58:05Z. **Review:** COMMENTED --- The GuestLibcInternalDeletingDestructors fixture passed on Linux with the exact changed sources. The fixture verifies cleanup of the three facet-owned strings, facet deletion and null-argument handling. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/27697:upstream-pr/27697'
git switch 'upstream-pr/27697'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/27697'
git switch 'upstream-pr/27697'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/27697'
git switch 'upstream-pr/27697'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/27697'
git switch 'main'
git merge --squash 'upstream-pr/27697'
git switch 'main'
git merge --ff-only 'upstream-pr/27697'
git switch 'main'
git merge 'upstream-pr/27697'
git push origin 'main'
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!27697
No description provided.