feat(libSceLibcInternal): implement the remaining messages constructor forms #23867

Merged
GiannisG1 merged 1 commit from upstream-pr/23867 into main 2026-11-21 08:11:26 +00:00
GiannisG1 commented 2026-11-19 20:17:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by GiannisG1 on 2026-11-19T20:17:46Z.


What

#21904 implemented seven messages<char> and messages<wchar_t> constructors. Five other forms of the same constructors were still inventory placeholders that threw:

Form Inventory NID
messages<char>::messages(size_t), complete object (C1) 151 6gCBQs1mIi4
messages<char>::messages(const char*, size_t), base object (C2) 152 qF3mHeMAHVk
messages<wchar_t>::messages(size_t), C1 156 n4+3hznhkU4
messages<wchar_t>::messages(const char*, size_t), C2 157 DlDsyX+XsoA
messages<wchar_t>::messages(const _Locinfo&, size_t), C2 158 DDQjbwNC31E

The Itanium C++ ABI emits identical complete- and base-object constructors for a class without virtual bases, so a title built against either symbol expects the same object. Each form now calls the same Construct, ConstructNamed or ConstructFrom helper as its implemented sibling in Messages.cpp. The mangled names hash to the inventory NIDs (tools/nid_names.py), so the exports are named and the five placeholders are gone. The debt fragment removes the five table rows and adds a Functional entry: the forms share their siblings' unverified points.

Tested

Linux Mint 22.3, GCC 13.3.0, Release, head on main e4cee4952b.

  • guest_libc_internal_messages now builds each new form over a filled 0x10-byte object. It checks, as for the siblings, that only the vtable (the exported messages<char> one, or the library's messages<wchar_t> one) and the reference count are written: C1 and C2 (size_t) with a 64-bit count, C2 (const char*, size_t) with "C", and the wide C2 (const _Locinfo&, size_t).
  • main: the test does not link, because none of the five exports exists there. This PR: passes 3/3.
  • Split suite (tools/suite.py) on this branch: GPU tests on a GTX 1050 Ti (NVIDIA 580.178.04), an HD 630 (Mesa 25.2.8 ANV) and llvmpipe 25.2.8, everything else once.
    • The results match the main e4cee4952b baseline (GTX none failed, HD 630 the same 10, llvmpipe the same 3), plus agc_driver_pm4_order_signal on the HD 630.
    • That test checks for a median below 0.1 ms and does not load libSceLibcInternal. Interleaved with a main build, 5 runs per GPU, both builds failed 7 of 15.
    • guest_libc_internal_messages and public_headers pass.
  • check_conventions.py, check_test_registration.py, check_main_sync.py (merges cleanly), check_compile.py and debt_fold.py --check are clean. progress.py --module libSceLibcInternal lists none of the messages constructors as pending.
  • pr_overlap.py --branch: #17300 (rename-only) names the same five aliases. #13778, #14834, #17300 and #18135 could not be compared because they conflict with main. A trial merge with each adds no conflicting file beyond those it already has. It merges cleanly with #22370 and with our #23809, #23837, #23846 and #23858.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5402271842 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23867). Originally posted by [GiannisG1](https://github.com/GiannisG1) on 2026-11-19T20:17:46Z. --- ### What #21904 implemented seven `messages<char>` and `messages<wchar_t>` constructors. Five other forms of the same constructors were still inventory placeholders that threw: | Form | Inventory | NID | |---|---|---| | `messages<char>::messages(size_t)`, complete object (C1) | 151 | `6gCBQs1mIi4` | | `messages<char>::messages(const char*, size_t)`, base object (C2) | 152 | `qF3mHeMAHVk` | | `messages<wchar_t>::messages(size_t)`, C1 | 156 | `n4+3hznhkU4` | | `messages<wchar_t>::messages(const char*, size_t)`, C2 | 157 | `DlDsyX+XsoA` | | `messages<wchar_t>::messages(const _Locinfo&, size_t)`, C2 | 158 | `DDQjbwNC31E` | The [Itanium C++ ABI](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-special-ctor-dtor) emits identical complete- and base-object constructors for a class without virtual bases, so a title built against either symbol expects the same object. Each form now calls the same `Construct`, `ConstructNamed` or `ConstructFrom` helper as its implemented sibling in `Messages.cpp`. The mangled names hash to the inventory NIDs (`tools/nid_names.py`), so the exports are named and the five placeholders are gone. The debt fragment removes the five table rows and adds a Functional entry: the forms share their siblings' unverified points. ### Tested Linux Mint 22.3, GCC 13.3.0, Release, head on `main` `e4cee4952b`. - `guest_libc_internal_messages` now builds each new form over a filled 0x10-byte object. It checks, as for the siblings, that only the vtable (the exported `messages<char>` one, or the library's `messages<wchar_t>` one) and the reference count are written: C1 and C2 `(size_t)` with a 64-bit count, C2 `(const char*, size_t)` with "C", and the wide C2 `(const _Locinfo&, size_t)`. - `main`: the test does not link, because none of the five exports exists there. This PR: passes 3/3. - Split suite (`tools/suite.py`) on this branch: GPU tests on a GTX 1050 Ti (NVIDIA 580.178.04), an HD 630 (Mesa 25.2.8 ANV) and llvmpipe 25.2.8, everything else once. - The results match the `main` `e4cee4952b` baseline (GTX none failed, HD 630 the same 10, llvmpipe the same 3), plus `agc_driver_pm4_order_signal` on the HD 630. - That test checks for a median below 0.1 ms and does not load libSceLibcInternal. Interleaved with a `main` build, 5 runs per GPU, both builds failed 7 of 15. - `guest_libc_internal_messages` and `public_headers` pass. - `check_conventions.py`, `check_test_registration.py`, `check_main_sync.py` (merges cleanly), `check_compile.py` and `debt_fold.py --check` are clean. `progress.py --module libSceLibcInternal` lists none of the `messages` constructors as pending. - `pr_overlap.py --branch`: #17300 (rename-only) names the same five aliases. #13778, #14834, #17300 and #18135 could not be compared because they conflict with `main`. A trial merge with each adds no conflicting file beyond those it already has. It merges cleanly with #22370 and with our #23809, #23837, #23846 and #23858. ### 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)
PrivacyOnion commented 2026-11-19 20:25:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T20:25:02Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against b415e2cf77:

  • Conventions: tools/check_conventions.py passed.
  • Build: guest_libc_internal_messages_tests built cleanly.
  • CTest (guest_libc_internal_messages):
    1/1 Test #4410: guest_libc_internal_messages .....   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceLibcInternal/InventoryExports.cpp, core/libs/prx/libSceLibcInternal/Messages.cpp, core/libs/prx/libSceLibcInternal/include/Api.hpp, core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified Itanium C++ ABI mangling and equivalence: complete object (C1) and base object (C2) constructors are structurally and semantically identical for non-virtual inheritance facet classes messages and messages<wchar_t>.
    • Verified parameter validation in Construct, ConstructNamed, and ConstructFrom in Messages.cpp: self and locinfo null checks throw std::invalid_argument appropriately.
    • Verified cross-platform 64-bit integer handling: Construct correctly casts references across 32-bit references and reserved fields without narrowing bugs on LP64 and LLP64.
    • Verified header declarations and symbol removals in Api.hpp, InventoryExports.hpp, and InventoryExports.cpp: NIDs match exports and no duplicate symbols remain.
    • Verified test coverage in GuestLibcInternalMessages.cpp: all 5 new constructor forms are exercised, verifying vtable and reference count initialization on filled memory.
    • Verified technical debt fragment docs/dev/debt/changes/feat-libcinternal-messages-ctor-aliases.md matches the removed symbols and repository conventions.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5982768547 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23867#pullrequestreview-5982768547). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-19T20:25:02Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `b415e2cf77`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `guest_libc_internal_messages_tests` built cleanly. - **CTest** (`guest_libc_internal_messages`): ``` 1/1 Test #4410: guest_libc_internal_messages ..... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceLibcInternal/InventoryExports.cpp`, `core/libs/prx/libSceLibcInternal/Messages.cpp`, `core/libs/prx/libSceLibcInternal/include/Api.hpp`, `core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified Itanium C++ ABI mangling and equivalence: complete object (C1) and base object (C2) constructors are structurally and semantically identical for non-virtual inheritance facet classes messages<char> and messages<wchar_t>. - Verified parameter validation in Construct, ConstructNamed, and ConstructFrom in Messages.cpp: self and locinfo null checks throw std::invalid_argument appropriately. - Verified cross-platform 64-bit integer handling: Construct correctly casts references across 32-bit references and reserved fields without narrowing bugs on LP64 and LLP64. - Verified header declarations and symbol removals in Api.hpp, InventoryExports.hpp, and InventoryExports.cpp: NIDs match exports and no duplicate symbols remain. - Verified test coverage in GuestLibcInternalMessages.cpp: all 5 new constructor forms are exercised, verifying vtable and reference count initialization on filled memory. - Verified technical debt fragment docs/dev/debt/changes/feat-libcinternal-messages-ctor-aliases.md matches the removed symbols and repository conventions. Looks Good To Me
MarcZX10 commented 2026-11-20 12:09:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T12:09:56Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected changes consistently route the five constructor forms through their implemented sibling helpers; validation was not run in this review.

What I ran

Reviewed head b415e2cf77c0db006d1eaf646febc38e981d6fda. No commands or tests were run; source was inspected through repo_read.py.

Results

Check Result Note
Source review passed All six changed files inspected
Tests and checks not run Description reports author-run checks

Findings

Blocking

None.

Non-blocking

None.

Not verified

Builds, tests, and runtime behavior were not independently verified. The reported Linux and GPU results are author supplied. All six files listed in the manifest were read: InventoryExports.cpp, Messages.cpp, Api.hpp, InventoryExports.hpp, GuestLibcInternalMessages.cpp, and the debt change fragment. No files were excluded in the manifest.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5992425254 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/23867#pullrequestreview-5992425254). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T12:09:56Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected changes consistently route the five constructor forms through their implemented sibling helpers; validation was not run in this review. ## What I ran Reviewed head `b415e2cf77c0db006d1eaf646febc38e981d6fda`. No commands or tests were run; source was inspected through `repo_read.py`. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | All six changed files inspected | | Tests and checks | not run | Description reports author-run checks | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified Builds, tests, and runtime behavior were not independently verified. The reported Linux and GPU results are author supplied. All six files listed in the manifest were read: `InventoryExports.cpp`, `Messages.cpp`, `Api.hpp`, `InventoryExports.hpp`, `GuestLibcInternalMessages.cpp`, and the debt change fragment. No files were excluded in the manifest. ## To get this to a good state Nothing is required.
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!23867
No description provided.