feat(libc): count the std::__sce_v2 _Winit and ios_base::Init initializations #15602
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15602"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Danigamer05 on 2026-11-03T21:19:26Z.
What
Add the versioned
std::__sce_v2stream initialization counters to libc:_ZNSt8__sce_v26_Winit9_Init_cntE(data,int)RHJsm6Tv-hE0x1939E0_ZNSt8__sce_v26_WinitC1Ev++NWMgKWsek0x10C130_ZNSt8__sce_v26_WinitC2Ev9GII7ZFbzH40x10C130_ZNSt8__sce_v26_WinitD1EvN5sgKofpQtY0x10C150_ZNSt8__sce_v26_WinitD2Ev8CsRpCsiGzQ0x10C150_ZNSt8__sce_v28ios_base4Init9_Init_cntE(data,int)mpVSzo64joI0x1939E8_ZNSt8__sce_v28ios_base4Init10_Init_ctorEPS1_TY4Lfh4lHn80x10D7B0_ZNSt8__sce_v28ios_base4Init10_Init_dtorEPS1_DXtdV6bncOA0x10D7D0_ZNSt8__sce_v28ios_base4Init14_Init_cnt_funcEvwhkr2W9X2ZQ0x10D7A0The behavior comes from the
libc.prxbundled with PPSA03671 v01.001.005 (J03848509, SHA-256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6). A title whose<iostream>uses the versioned library calls the_Winitandios_base::Initconstructors and destructors from its static initializers and finalizers._Init_cntcounters start at -1, as in the module's.data._Init_ctorraise a negative count to 1 and otherwise add 1._Init_dtorsubtract 1._Init_cnt_funcreturns the address of theios_base::Initcounter.When a count reaches 0 the module flushes its versioned wide or narrow standard streams through their
_Ptr_*pointers. This libc has no versioned standard stream objects, so there is nothing to flush; the debt entry records it. The code is in a newVersionedStreamInit.cpp.Tested
Windows x86-64, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, main04a9eb4fa28. Exact tested commit:0ff5d61b646.guest_sce_v2_stream_initpasses, along withpublic_headers,guest_math_exact,guest_sce_v2_float_helpers,guest_sce_v2_filesystem_callsandguest_random_device_seed._Init_cnt_funcreturns._Init_cnt_func. The module's counters and the exported counters were equal after every call._Init_dtor, and the counter_Init_cnt_funcreturns. The new CTest and the side-by-side run failed on each. The source was then restored byte for byte (SHA-256 checked) and rebuilt, and both passed again.git diff --checkpass.tools/pr_overlap.pyread 1,774 open PRs before the rebases onto086c0686c8aand04a9eb4fa28and reports no overlap; both rebases were clean. It keeps exit 2 for 30 branches that already conflict with main. Merging each with this branch and with main usinggit merge-treegives the same conflict blocks; only #13486 names related symbols, the unversioned_Winitandios_base::Initconstructors in a table. The branch also merges cleanly with #15336, #15471, #15484, #15490, #15501, #15519, #15552 and #15561.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
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code