feat(libc): export the time_put facet vtable as data #12510

Merged
mazen320 merged 3 commits from upstream-pr/12510 into main 2026-11-06 01:36:56 +00:00
mazen320 commented 2026-10-28 16:36:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mazen320 on 2026-10-28T16:36:25Z.


What

Export time_put<char>'s vtable (NID OwfBD-2nhJQ) as seven zeroed uintptr_t slots so titles that resolve it as data get a 56-byte object matching console title libc.prx (PPSA26344). Facet calls through the slots still fault until methods are wired (debt note). _Getcat still installs g_timePutVtable for facets it builds.

#9038 (codecvt / numpunct / time_put _Getcat) has landed and is orthogonal. Merge order for the new facet-vtable stack: this PR, then #12511 (money_get), then #12518 (money_put). Other open facet-vtable PRs (#10158, #10200, #10165, #9761) edit different symbols/sections; compose with keep-both on rebase.

Tested

  • guest_locale_tests — passed (Windows MinGW).
  • python tools/check_conventions.py --base upstream/main — passed.
  • Console: OwfBD-2nhJQ is STT_OBJECT st_size 56 in PPSA26344 sce_module/libc.prx (dynsym via PT_DYNAMIC; FTP from the console).

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 (base of stack; #12511/#12518 rebase on this tip; #10158/#10200/#10165/#9761/#6565/#9371 share other LocaleSupport/debt sections — keep-both)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (libc data export)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5054108495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12510). Originally posted by [mazen320](https://github.com/mazen320) on 2026-10-28T16:36:25Z. --- ### What Export `time_put<char>`'s vtable (NID `OwfBD-2nhJQ`) as seven zeroed `uintptr_t` slots so titles that resolve it as data get a 56-byte object matching console title `libc.prx` (PPSA26344). Facet calls through the slots still fault until methods are wired (debt note). `_Getcat` still installs `g_timePutVtable` for facets it builds. #9038 (`codecvt` / `numpunct` / `time_put` `_Getcat`) has landed and is orthogonal. Merge order for the new facet-vtable stack: this PR, then #12511 (`money_get`), then #12518 (`money_put`). Other open facet-vtable PRs (#10158, #10200, #10165, #9761) edit different symbols/sections; compose with keep-both on rebase. ### Tested - `guest_locale_tests` — passed (Windows MinGW). - `python tools/check_conventions.py --base upstream/main` — passed. - Console: `OwfBD-2nhJQ` is STT_OBJECT `st_size` 56 in PPSA26344 `sce_module/libc.prx` (dynsym via PT_DYNAMIC; FTP from the console). ### 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 (base of stack; #12511/#12518 rebase on this tip; #10158/#10200/#10165/#9761/#6565/#9371 share other LocaleSupport/debt sections — keep-both) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (libc data export) - [x] AI-assisted: yes
rooklz commented 2026-10-29 04:13:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T04:13:19Z.

Review: APPROVED


I checked tip d295b98f23 on the host: macOS 26, x86_64, clang with ASan+UBSan.

Name / layout. tools/nid_names.py --name _ZTVSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE gives OwfBD-2nhJQ, which matches the body and the debt line. Seven slots are offset-to-top, typeinfo, the four FacetVtable entries and TimePutVtable::put (GuestLocale.hpp L126-129). That fits the measured st_size 56, and it is the same shape #12704 uses for the wide form. _Getcat still installs g_timePutVtable (L765), so facet construction does not change.

Run. I built a standalone guest_locale_tests from LocaleSupport.cpp and core/libs/tests/GuestLocale.cpp, both unmodified. A shim supplied the heap hooks, _Locksyslock/_Unlocksyslock, _Znwm/_ZdlPv and __error, and forwarded snprintf/strftime to the host. I dropped CheckTimePut and CheckNumPut from main() because they fail the same way on main under a host-strftime shim (%E/%O), which is unrelated to this PR.

  • head: the other 20 checks pass (including the new CheckTimePutVtableObject), with no sanitizer reports
  • main's LocaleSupport.cpp with the new test: link fails on the undefined _ZTVSt8time_put..., so the test fails without this change

Mutants (all killed):

mutant result
{} → {1} test fails
only the last slot non-zero test fails
kTimePutCharVtableSlots = 8 static_assert
definition [6] redefinition error
definition dropped link error
const definition redefinition error

Merge. git merge-tree against main b433c40f2f is clean, and check_conventions --base upstream/main passes. Local pr_overlap --branch (1421 open PRs) reports no Same exports. The conflicts are the adjacent appends in GuestLocale.hpp, GuestLocale.cpp and debt/libc.md with #9761, #10158, #10165, #10200, #12511, #12518 and #12704, which the body already lists as keep-both.

LGTM.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5692773779 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12510#pullrequestreview-5692773779). Originally posted by [rooklz](https://github.com/rooklz) on 2026-10-29T04:13:19Z. **Review:** APPROVED --- I checked tip `d295b98f23` on the host: macOS 26, x86_64, clang with ASan+UBSan. **Name / layout.** `tools/nid_names.py --name _ZTVSt8time_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE` gives `OwfBD-2nhJQ`, which matches the body and the debt line. Seven slots are offset-to-top, typeinfo, the four `FacetVtable` entries and `TimePutVtable::put` (`GuestLocale.hpp` L126-129). That fits the measured `st_size` 56, and it is the same shape #12704 uses for the wide form. `_Getcat` still installs `g_timePutVtable` (L765), so facet construction does not change. **Run.** I built a standalone `guest_locale_tests` from `LocaleSupport.cpp` and `core/libs/tests/GuestLocale.cpp`, both unmodified. A shim supplied the heap hooks, `_Locksyslock`/`_Unlocksyslock`, `_Znwm`/`_ZdlPv` and `__error`, and forwarded `snprintf`/`strftime` to the host. I dropped `CheckTimePut` and `CheckNumPut` from `main()` because they fail the same way on `main` under a host-`strftime` shim (`%E`/`%O`), which is unrelated to this PR. - head: the other 20 checks pass (including the new `CheckTimePutVtableObject`), with no sanitizer reports - `main`'s `LocaleSupport.cpp` with the new test: link fails on the undefined `_ZTVSt8time_put...`, so the test fails without this change **Mutants** (all killed): | mutant | result | |---|---| | `{}` → `{1}` | test fails | | only the last slot non-zero | test fails | | `kTimePutCharVtableSlots = 8` | `static_assert` | | definition `[6]` | redefinition error | | definition dropped | link error | | `const` definition | redefinition error | **Merge.** `git merge-tree` against `main` b433c40f2f is clean, and `check_conventions --base upstream/main` passes. Local `pr_overlap --branch` (1421 open PRs) reports no Same exports. The conflicts are the adjacent appends in `GuestLocale.hpp`, `GuestLocale.cpp` and `debt/libc.md` with #9761, #10158, #10165, #10200, #12511, #12518 and #12704, which the body already lists as keep-both. LGTM. AI-assisted: yes
MarcZX10 commented 2026-10-29 05:15:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T05:15:49Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

The current-main rebase and the measured time_put<char> export look good, but the checklist uses the title-unblock field to describe the next PR in the stack.

What I ran

  • Inspected head 0780fd984f838420b15891674b5840ea49b9e80d against current main 52c09d567d2fa453494dd720fcf53a98149468e4.
  • Ran a current-main merge preview and git diff --check for the exact-head diff.
  • Checked the author’s test/conventions report and hosted checks. The author reports guest_locale_tests and conventions pass on Windows MinGW; current conventions, eligibility, labels, report, Ubuntu/Windows relinker, Ubuntu register-context and relinker ASan pass. Linux product tests are skipped; macOS jobs are queued.

Results

Check Result
Current-main merge preview Clean; tree 37bae2193249e9f8d59dfb4ede0e9a94cf7afb77
Diff whitespace Passed; no output
Focused locale test Author reports guest_locale_tests passed on Windows MinGW
Hosted checks Listed passing checks above; Linux product skipped; macOS jobs queued
Raw output
$ git merge-tree --write-tree refs/review/main-20261029b refs/review/pr-12510-20261029
37bae2193249e9f8d59dfb4ede0e9a94cf7afb77
exit=0
$ git diff --check refs/review/main-20261029b...refs/review/pr-12510-20261029
(no output; exit=0)

Negative control

  • Not run in this re-check. The report’s focused test is author-provided; the title st_size measurement is also author-provided.

Findings

Blocking

  • The checklist says Unblocks: #12511, but that is the next PR in this facet stack, not a title ID and Game bring-up discussion for a measured title stop or wrong result. CONTRIBUTING requires Unblocks: PPSA... #... for such a title-specific fix, and none otherwise. Please set this field to Unblocks: none; the sequence is already described on the Depends on line and in the PR body.

Non-blocking

  • The seven-slot object, matching st_size report, writable-object test, and corresponding debt note are consistent in the reviewed diff.

Sources

Not verified

  • I did not run the locale test locally or independently inspect the console ELF measurement. macOS jobs are queued and Linux product tests were skipped.

To get this to a good state

Change the checklist to Unblocks: none. The current-main branch and test report now address my remaining technical re-check.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693172544 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12510#pullrequestreview-5693172544). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T05:15:49Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested The current-main rebase and the measured `time_put<char>` export look good, but the checklist uses the title-unblock field to describe the next PR in the stack. ## What I ran - Inspected head `0780fd984f838420b15891674b5840ea49b9e80d` against current `main` `52c09d567d2fa453494dd720fcf53a98149468e4`. - Ran a current-main merge preview and `git diff --check` for the exact-head diff. - Checked the author’s test/conventions report and hosted checks. The author reports `guest_locale_tests` and conventions pass on Windows MinGW; current conventions, eligibility, labels, report, Ubuntu/Windows relinker, Ubuntu register-context and relinker ASan pass. Linux product tests are skipped; macOS jobs are queued. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean; tree `37bae2193249e9f8d59dfb4ede0e9a94cf7afb77` | | Diff whitespace | Passed; no output | | Focused locale test | Author reports `guest_locale_tests` passed on Windows MinGW | | Hosted checks | Listed passing checks above; Linux product skipped; macOS jobs queued | <details> <summary>Raw output</summary> ```text $ git merge-tree --write-tree refs/review/main-20261029b refs/review/pr-12510-20261029 37bae2193249e9f8d59dfb4ede0e9a94cf7afb77 exit=0 $ git diff --check refs/review/main-20261029b...refs/review/pr-12510-20261029 (no output; exit=0) ``` </details> ## Negative control - Not run in this re-check. The report’s focused test is author-provided; the title `st_size` measurement is also author-provided. ## Findings ### Blocking - The checklist says `Unblocks: #12511`, but that is the next PR in this facet stack, not a title ID and Game bring-up discussion for a measured title stop or wrong result. CONTRIBUTING requires `Unblocks: PPSA... #...` for such a title-specific fix, and `none` otherwise. Please set this field to `Unblocks: none`; the sequence is already described on the `Depends on` line and in the PR body. ### Non-blocking - The seven-slot object, matching `st_size` report, writable-object test, and corresponding debt note are consistent in the reviewed diff. ## Sources - [Contribution rule at current main](https://github.com/boykopovar/AnyPS5/blob/52c09d567d2fa453494dd720fcf53a98149468e4/CONTRIBUTING.md#L62-L64) - [Checklist template at current main](https://github.com/boykopovar/AnyPS5/blob/52c09d567d2fa453494dd720fcf53a98149468e4/.github/pull_request_template.md#L15-L18) - [Implementation at reviewed head](https://github.com/boykopovar/AnyPS5/blob/0780fd984f838420b15891674b5840ea49b9e80d/core/libs/prx/libc/src/LocaleSupport.cpp) - [Test at reviewed head](https://github.com/boykopovar/AnyPS5/blob/0780fd984f838420b15891674b5840ea49b9e80d/core/libs/tests/GuestLocale.cpp) ## Not verified - I did not run the locale test locally or independently inspect the console ELF measurement. macOS jobs are queued and Linux product tests were skipped. ## To get this to a good state Change the checklist to `Unblocks: none`. The current-main branch and test report now address my remaining technical re-check.
MarcZX10 commented 2026-10-29 05:37:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T05:37:31Z.

Review: APPROVED


Re-checked — approved

The checklist now uses Unblocks: none, while preserving the declared stack order (#12510 → #12511 → #12518) in Depends on and the body. The current-main rebase and test report remain consistent with the previously reviewed implementation.

What I ran

  • Reviewed exact head 0780fd984f838420b15891674b5840ea49b9e80d against current main 52c09d567d2fa453494dd720fcf53a98149468e4.
  • Ran git merge-tree --write-tree and git diff --check.
  • Checked the exact-head test report and current hosted checks.

Results

Check Result
Current-main merge preview Clean
git diff --check Passed
Checklist Unblocks: none; declared stack order preserved
Focused test and conventions Author reports guest_locale_tests and conventions passed on the stack tip containing this head
Hosted checks Eligibility, conventions, labels, report, relinker, ASan, register-context, write-watch, and Windows checks pass; Linux product job is skipped

I did not run a local build. The requested checklist correction is resolved and the reported checks cover the exact stack tip.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5693327543 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12510#pullrequestreview-5693327543). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T05:37:31Z. **Review:** APPROVED --- # Re-checked — approved The checklist now uses `Unblocks: none`, while preserving the declared stack order (#12510 → #12511 → #12518) in `Depends on` and the body. The current-main rebase and test report remain consistent with the previously reviewed implementation. ## What I ran - Reviewed exact head `0780fd984f838420b15891674b5840ea49b9e80d` against current `main` `52c09d567d2fa453494dd720fcf53a98149468e4`. - Ran `git merge-tree --write-tree` and `git diff --check`. - Checked the exact-head test report and current hosted checks. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | `git diff --check` | Passed | | Checklist | `Unblocks: none`; declared stack order preserved | | Focused test and conventions | Author reports `guest_locale_tests` and conventions passed on the stack tip containing this head | | Hosted checks | Eligibility, conventions, labels, report, relinker, ASan, register-context, write-watch, and Windows checks pass; Linux product job is skipped | I did not run a local build. The requested checklist correction is resolved and the reported checks cover the exact stack tip.
MarcZX10 commented 2026-10-30 04:21:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-30T04:21:00Z.

Review: APPROVED


Reviewed — looks good

The new time_put<char> data export is explicitly sized, zero-initialized, covered by a matching test, and its unimplemented facet calls are documented.

What I ran

Reviewed head 931387040ac55c1c7401bce9926a2222867bf5f1 against current main 5ecef095b61e7a406b279c97896f3a8a6fbd6353; merge preview tree ec15dfd742cc36fedc88443cc64a6bcb2f960ef85b.

git merge-tree --write-tree refs/remotes/upstream/main refs/remotes/upstream/pr-12510
git diff --check refs/remotes/upstream/main...refs/remotes/upstream/pr-12510

Results

Check Result
Merge preview Clean
Diff check Passed; no output
Hosted conventions and Windows build Passed
Linux/product and specialized platform checks Skipped or still queued

Not verified

I did not run a local build/test or independently inspect the console image. The title-image symbol-size evidence and MinGW test result are reported by the author. PR #12510 is the first item in the declared vtable stack.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5708041150 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12510#pullrequestreview-5708041150). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-30T04:21:00Z. **Review:** APPROVED --- # Reviewed — looks good The new `time_put<char>` data export is explicitly sized, zero-initialized, covered by a matching test, and its unimplemented facet calls are documented. ## What I ran Reviewed head `931387040ac55c1c7401bce9926a2222867bf5f1` against current main `5ecef095b61e7a406b279c97896f3a8a6fbd6353`; merge preview tree `ec15dfd742cc36fedc88443cc64a6bcb2f960ef85b`. ```sh git merge-tree --write-tree refs/remotes/upstream/main refs/remotes/upstream/pr-12510 git diff --check refs/remotes/upstream/main...refs/remotes/upstream/pr-12510 ``` ## Results | Check | Result | |---|---| | Merge preview | Clean | | Diff check | Passed; no output | | Hosted conventions and Windows build | Passed | | Linux/product and specialized platform checks | Skipped or still queued | ## Not verified I did not run a local build/test or independently inspect the console image. The title-image symbol-size evidence and MinGW test result are reported by the author. PR #12510 is the first item in the declared vtable stack.
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!12510
No description provided.