feat(libc): export std::underflow_error type info, vtable and destructor #10608

Merged
edubox merged 3 commits from upstream-pr/10608 into main 2026-10-26 01:40:06 +00:00
edubox commented 2026-10-24 12:28:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-10-24T12:28:48Z.


What

Export std::underflow_error's type info (oNRAB0Zs2+0), vtable (ZrFcJ-Ab0vw) and destructor (ywv2X-q-9is) next to overflow_error.

Minecraft Legends (PPSA05510) imports _ZTISt15underflow_error; the library had no type info, vtable or destructor for this class, so the loader refused the title. The record uses the same single inheritance over runtime_error as overflow_error, and the destructor releases the allocated message.

Tested

CachyOS Linux 7.3.0-3, Ryzen 9 9900X, GCC 16.2.1, main b84322da6a.

  • cmake --build build --target guest_underflow_error_tests builds.
  • ctest --test-dir build -R '^guest_underflow_error$' passes. The test checks the type name, the base record, the shared vtable entries, construction through runtime_error(const char*) and that the destructor clears the message twice.
  • The patched libc.prx exports oNRAB0Zs2+0, ZrFcJ-Ab0vw and ywv2X-q-9is (nm -D).
  • Not tested with a 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
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4995384741 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10608). Originally posted by [edubox](https://github.com/edubox) on 2026-10-24T12:28:48Z. --- ### What Export `std::underflow_error`'s type info (`oNRAB0Zs2+0`), vtable (`ZrFcJ-Ab0vw`) and destructor (`ywv2X-q-9is`) next to `overflow_error`. Minecraft Legends (PPSA05510) imports `_ZTISt15underflow_error`; the library had no type info, vtable or destructor for this class, so the loader refused the title. The record uses the same single inheritance over `runtime_error` as `overflow_error`, and the destructor releases the allocated message. ### Tested CachyOS Linux 7.3.0-3, Ryzen 9 9900X, GCC 16.2.1, `main` `b84322da6a`. - `cmake --build build --target guest_underflow_error_tests` builds. - `ctest --test-dir build -R '^guest_underflow_error$'` passes. The test checks the type name, the base record, the shared vtable entries, construction through `runtime_error(const char*)` and that the destructor clears the message twice. - The patched `libc.prx` exports `oNRAB0Zs2+0`, `ZrFcJ-Ab0vw` and `ywv2X-q-9is` (`nm -D`). - Not tested with a 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 - [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
MarcZX10 commented 2026-10-24 12:35:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:35:30Z.

Review: APPROVED


Reviewed exact head 0d17917ef8. The typeinfo name and single-inheritance base, address-point offset, vtable entries, and D1 destructor follow the neighboring overflow_error record. The test directly checks those records and vtable slots, constructs a message through the shared runtime_error constructor, and verifies cleanup including repeated destruction. Hosted eligibility, conventions, intake, labels, report, register-context (Linux Debug/Release and macOS Intel Debug/Release), write-watch, Linux/macOS relinker, and ASan checks pass; Linux/Windows full product builds are skipped, and the Windows plus macOS x86-64 relinker jobs are still running. The focused guest_underflow_error build/test is reported by the author on Linux; I could not reproduce it locally because full CMake configuration stops at the missing system SDL2 package, and the worktree does not have submodules initialized. I found no code blocker.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638253526 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10608#pullrequestreview-5638253526). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T12:35:30Z. **Review:** APPROVED --- Reviewed exact head 0d17917ef8ad78c39b3d195707cd515a12d73945. The typeinfo name and single-inheritance base, address-point offset, vtable entries, and D1 destructor follow the neighboring `overflow_error` record. The test directly checks those records and vtable slots, constructs a message through the shared `runtime_error` constructor, and verifies cleanup including repeated destruction. Hosted eligibility, conventions, intake, labels, report, register-context (Linux Debug/Release and macOS Intel Debug/Release), write-watch, Linux/macOS relinker, and ASan checks pass; Linux/Windows full product builds are skipped, and the Windows plus macOS x86-64 relinker jobs are still running. The focused `guest_underflow_error` build/test is reported by the author on Linux; I could not reproduce it locally because full CMake configuration stops at the missing system SDL2 package, and the worktree does not have submodules initialized. I found no code blocker.
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!10608
No description provided.