feat(libc): implement ios_base::_Addstd #6975
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6975"
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 T3cm0 on 2026-10-17T00:22:18Z.
What
std::ios_base::_Addstd(LTov9gMEqCU) registers a stream in Dinkumware's standard stream table, as VC12's ios.cpp does: it takes the first of slots 1 to 7 that is free or already holds the stream, and slot 8 (NSTDSTR) when none is, stores that 1-based index in_Stdstr(offset 0x8 ofios_base) and raises the slot's open count.ios_base::~ios_basenow decrements that count and skips the rest of the destruction while it stays positive, as_Ios_base_dtordoes. Registration never fails: every stream past the first seven shares slot 8.PPSA28997 (God of War Sons of Sparta) stops at this export when it is a stub, as reported in #2040 ("On main (as of Oct 8) the title stops earlier, at
LTov9gMEqCU").Measured
PS5, firmware 13.60, from a homebrew payload (ps5-payload-sdk) linked against the system
libSceLibcInternalexport, calling_Addstdon 0x80-byte objects filled with 0xCC and listing every byte that changed:08 00 00 00 00 00 00 00No other byte of the objects changed. In that process the system library's own standard streams already hold slots 1 to 7, so every new stream lands in the shared slot 8; that is VC12's
++_Stdstr < NSTDSTRloop, not a table of 8 free slots that can run out. The order in which fresh streams take slots 1 to 7 is not observable there and follows VC12; this is recorded indocs/dev/debt/libc.md.Tested
guest_locale_testspasses; with the loop bound changed back to<=it fails.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
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-17T00:37:07Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libc.mdL117Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libc/src/RuntimeSupport.cppdocs/dev/debt/libc.mdcore/libs/tests/GuestLocale.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/prx/libc/src/LocaleSupport.cppdocs/dev/debt/libc.mdcore/libs/prx/libc/src/RuntimeSupport.cppcore/libs/prx/libc/src/RuntimeSupport.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdImported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T19:00:13Z.
Rebase handoff — rebased onto current
main(both commits, authorship unchanged). One docs conflict: your PS5-measured slot-8-sharing debt entry replacesmain's older_Addstddescription (main's unrelatedfopen_sentry kept).Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, AMD RX 9070 XT / RADV): builds; conventions pass; full suite green apart from the knownmainregression (agc_driver_tessellationsegfault — Mesa, #5444), not this PR.To pick it up:
Head is
9039f2df6.Imported from boykopovar/AnyPS5. Originally posted by T3cm0 on 2026-10-17T21:38:17Z.
Rebased onto current
mainagain (head0bae293d8): #6133 added__modti3right above the_Addstdstub this PR removes, so the resolution keeps__modti3and drops only the stub. The change is the same four files as before.Checked after the rebase:
guest_localeandguest_crtpass on Windows 11 (MinGW GCC 15.2, Release) andcheck_conventionspasses; the earlier Linux run by @blawesom covers the same code. Thanks for the first rebase.When convenient, could a maintainer run the full build workflow for this PR?
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T12:40:54Z.
Progress report (
b106f6f→6fdb88f)📈 System libraries: 81.69% (+0.02%, +1 implemented functions)
✅ 1 implemented
_ZNSt8ios_base7_AddstdEPS__nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T17:37:34Z.
Checked the
_Addstdloop and slot-8 sharing against VC12'sios.cppand the PS5 measurements in the description, the destructor count and early return, the out-of-range slot throw, and that the new test pins the<bound.maingainedsetwat the same spot; rebased onto it keeping both sides (no logic change),guest_localeand the libc-scope ctest pass; merged.