Repository navigation
feat(libc): expose narrow libc++ basic_istream<char> vtable - #29268
cmsierrave-coder wants to merge 13 commits into
Conversation
Add the std::__1 iostream_category and the ios_base::failure const char* and string constructors, D1, D2, RTTI and vtable. failure is a system_error with its own vtable and typeinfo, so what() is msg + ": " + message() for a nonzero code. iostream_category is named "iostream" and reports "unspecified iostream_category error" for io_errc::stream (1) and from the ELAST cutoff on, strerror text otherwise, as LLVM libc++ 17 ios.cpp does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the libc++ 17 ios_base object layout and its offset asserts from LibcxxIosInit.cpp to GuestLocale.hpp as LibcxxIosBase, next to LibcxxLocale, so the basic_ostream exports can read the stream state, exception mask, buffer and format flags through the same checked layout instead of a second copy. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add ios_base::clear and the basic_ostream<char> sentry constructor and destructor, put, write, flush and the complete and base destructors, imported by RetroArch's Azahar core (PPSA99169). They follow LLVM libc++ 17.0.6 <ostream>, <ios>, <streambuf> and ios.cpp. The basic_ios virtual base is found through the virtual-base offset at vtable slot -24, and the stream buffer's sync, xsputn and overflow are called through the guest object's vtable; put writes into the put area as the inline sputc does. clear throws ios_base::failure with io_errc::stream as a guest exception. Exceptions from the stream buffer are caught like libc++ does, since guest and host share libc's exception runtime: badbit is set and the exception is rethrown when the mask has badbit. The sentry destructor skips pubsync while libc's uncaught exception count is nonzero. The base destructor does nothing and ignores the VTT, matching clang's code for the empty destructor body; the complete destructor runs the basic_ios<char> base destructor on the virtual base. Unreadable objects and missing virtual functions throw invalid_argument and are not turned into badbit. The gaps are recorded in the libc debt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eam buffers per export MakeStream and MakeBuffer returned objects that point into themselves, so the test relied on copy elision. The fixtures are now set up in the caller's objects. The debt entry now says what each export does with no stream buffer, instead of listing them all as throwing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 1cbf7d5)
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
|
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The reviewed change at head 65517b062c4d35b4d3b1f18860008db5d7ed0a06 exposes the narrow basic_istream<char> vtable and its destructor dispatch without a verified blocking defect.
What I ran
Inspected the prepared diff and manifest, then read the changed code and tests at the pinned head. No build or test command was run.
repo_read.py cat <repository path> <start line> <end line>
sed -n <range> <prepared review file>
The reader inspection covered the vtable, destructor, RTTI, ostream, and guest test changes. Files listed under reviewed in files.json were read; files.json lists no excluded files. The author reports that the guest tests passed on Windows MSYS2; I did not run them.
Results
| Check | Result | Note |
|---|---|---|
| Changed-file review | passed | All reviewed files inspected |
| Guest tests | not run | Author reports passing run |
| Console behavior | not run | Remains unverified |
Negative control
Not run; no tests were executed in this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
- Istream vtable and destructor dispatch at the reviewed head
- Stream RTTI and address-point definitions at the reviewed head
- Guest destructor dispatch checks at the reviewed head
Not verified
Retail-console behavior and RetroArch/Azahar startup were not verified. The reported CI run was not independently confirmed.
To get this to a good state
Nothing is required.
|
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.
|
What
Expose the narrow libc++ basic_istream vtable as kfWkebGVqEQ. The 80-byte table puts the primary address point at 0x18 and the virtual basic_ios address point at 0x40. Both use the existing istream type record and the matching complete and deleting destructor entries.
Feature commit
Tested
Windows MSYS2 Release on the fork passed
guest_libcxx_istream_destructorsfor38764fc1b4c6. GitHub Actions runThe guest test checks the two address points, the RTTI downcast from basic_ios, and complete and deleting dispatch from both subobjects.
Compared the guest object sizes and layout to the PS5 Payload SDK v0.42
libc++.aarchive. SDK releaseRetroArch/Azahar startup and retail console behavior remain unverified.
The branch merges into upstream snapshot efbc232. An exact scan of 1,697 open libc source trees found no owner for kfWkebGVqEQ.
Windows MSYS2 Release passed guest_libcxx_istream_destructors again on PR head 65517b0 after merging the upstream ios_base fix. Final-head run
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)