feat(libc): export the std::error_category complete and deleting destructors #15796

Merged
Danigamer05 merged 1 commit from upstream-pr/15796 into main 2026-11-08 01:19:15 +00:00
Danigamer05 commented 2026-11-04 16:16:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Danigamer05 on 2026-11-04T16:16:07Z.


What

Export the complete-object and deleting destructors of std::error_category from libc.

Export NID Original RVA
_ZNSt14error_categoryD1Ev ft5HxbN0c1o 0xB4470
_ZNSt14error_categoryD0Ev 6CcKkO-b8-0 0xB4480

The behavior comes from the libc.prx bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6).

In the module:

  • D1 is a single ret at the same address as the base-object destructor D2, which main already exports as an empty function. D1 is the same empty function;
  • D0 is a single ud2: deleting an error_category through this destructor traps. It throws std::runtime_error here instead, with the text that AtomicBuiltins.cpp uses for the console's ud2 paths. The debt entry records that difference.

Tested

Windows x86-64, WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON, main b11c7bf84f5. Exact tested commit: 7ea5bf5e5f6.

  • Built libc, libkernel, their NID-patched production libraries and the related tests. Both names are in the generated libc.exports. guest_future_category passes with the new checks, along with guest_sce_v2_exceptions, guest_filesystem_error, guest_libc_internal_exception_destructors, exception_personality, windows_exceptions and public_headers.
  • guest_future_category now calls D1 next to the existing D2 call, and checks that D0 throws a std::runtime_error naming the console trap.
  • The two bodies were read from the module's disassembly. They were not run side by side: D1 does nothing, and D0 would stop the harness.
  • Negative control: two lines were altered one at a time: D0 threw std::logic_error, and D1 called D0. guest_future_category failed on each. The source was then restored byte for byte (SHA-256 checked) and rebuilt, and the test passed again.
  • Code conventions and git diff --check pass.
  • tools/pr_overlap.py read 1,863 open PRs at the tested commit and reports no overlap. It keeps exit 2 for 25 branches that already conflict with main. Merging each of the 25 with this branch and with main using git merge-tree gives the same conflict blocks. Only #13486 names a related symbol: it lists the destructors of the derived _Future_error_category, _System_error_category, _Generic_error_category and _Iostream_error_category in a table, not these two. The branch also merges cleanly with #15336, #15471, #15484, #15490, #15501, #15519, #15552, #15561, #15602, #15614, #15667, #15683 and #15791.

Not tested: Linux, macOS, another SDK, a game, GPU or console. No game compatibility claim. No original module, extracted bytes, harness or log is committed or uploaded.

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: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5157625086 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15796). Originally posted by [Danigamer05](https://github.com/Danigamer05) on 2026-11-04T16:16:07Z. --- ### What Export the complete-object and deleting destructors of `std::error_category` from libc. | Export | NID | Original RVA | | --- | --- | --- | | `_ZNSt14error_categoryD1Ev` | `ft5HxbN0c1o` | `0xB4470` | | `_ZNSt14error_categoryD0Ev` | `6CcKkO-b8-0` | `0xB4480` | The behavior comes from the `libc.prx` bundled with PPSA03671 v01.001.005 (J03848509, SHA-256 `483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6`). In the module: - `D1` is a single `ret` at the same address as the base-object destructor `D2`, which main already exports as an empty function. `D1` is the same empty function; - `D0` is a single `ud2`: deleting an `error_category` through this destructor traps. It throws `std::runtime_error` here instead, with the text that `AtomicBuiltins.cpp` uses for the console's `ud2` paths. The debt entry records that difference. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows x86-64, WinLibs GCC 15.2.0, Release, `BUILD_TESTING=ON`, main `b11c7bf84f5`. Exact tested commit: `7ea5bf5e5f6`. - Built libc, libkernel, their NID-patched production libraries and the related tests. Both names are in the generated `libc.exports`. `guest_future_category` passes with the new checks, along with `guest_sce_v2_exceptions`, `guest_filesystem_error`, `guest_libc_internal_exception_destructors`, `exception_personality`, `windows_exceptions` and `public_headers`. - `guest_future_category` now calls `D1` next to the existing `D2` call, and checks that `D0` throws a `std::runtime_error` naming the console trap. - The two bodies were read from the module's disassembly. They were not run side by side: `D1` does nothing, and `D0` would stop the harness. - Negative control: two lines were altered one at a time: `D0` threw `std::logic_error`, and `D1` called `D0`. `guest_future_category` failed on each. The source was then restored byte for byte (SHA-256 checked) and rebuilt, and the test passed again. - Code conventions and `git diff --check` pass. - `tools/pr_overlap.py` read 1,863 open PRs at the tested commit and reports no overlap. It keeps exit 2 for 25 branches that already conflict with main. Merging each of the 25 with this branch and with main using `git merge-tree` gives the same conflict blocks. Only #13486 names a related symbol: it lists the destructors of the derived `_Future_error_category`, `_System_error_category`, `_Generic_error_category` and `_Iostream_error_category` in a table, not these two. The branch also merges cleanly with #15336, #15471, #15484, #15490, #15501, #15519, #15552, #15561, #15602, #15614, #15667, #15683 and #15791. Not tested: Linux, macOS, another SDK, a game, GPU or console. No game compatibility claim. No original module, extracted bytes, harness or log is committed or uploaded. ### 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: 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)
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!15796
No description provided.