Repository navigation
feat(libc): implement ios_base::_Addstd - #6975
Conversation
|
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.
Some 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.
|
|
Rebase handoff — rebased onto current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, To pick it up: Head is |
9039f2d to
0bae293
Compare
|
Rebased onto current Checked after the rebase: When convenient, could a maintainer run the full build workflow for this PR? |
Queue the stream in the table of the 8 standard stream slots of Dinkumware's ios.cpp: the first free slot or the one that already holds the stream, with a reference count per slot, and the destructor suppresses the destruction of a standard stream while its slot still has open references.
0bae293 to
6fdb88f
Compare
|
Checked the |
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