Repository navigation
feat(libc): export std::setw(int) - #6585
Merged
Merged
Conversation
Dinkumware's setw returns a manipulator holding a function pointer and the width, which the caller applies to the stream; the function stores the width in the stream's ios_base. The export returns that pair in RAX:RDX and the function writes ios_base::width, leaving flags and precision alone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
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.
|
Contributor
|
Windows run, since Windows is untested. Windows 11, WinLibs GCC 15.2.0 r7 (MinGW), Release,
Not tested: a negative control on Windows. AI-assisted: yes (Claude Code) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Exports
std::setw(int)(_ZSt4setwi) from libc. Sony's libc is Dinkumware, wheresetwreturns a manipulator that holds a function pointer and the width (16 bytes, returned in RAX:RDX); the caller invokes the pointer with the stream'sios_baseand the width. The returned function stores the width in the stream'sios_base(GuestLocale::IosBase::width, offset 0x20) and returns the stream, leaving flags and precision alone; a null stream throws. The call convention comes from the title's own call site (mov esi, edx; call rax), andflagsat 0x18 in that code matches the existingIosBaselayout.PPSA21402 imports
setwand no library exported it:tools/import_audit.pylists it as the title's only absent import, and reports 0 absent with this change.Tested
Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON, Intel Arc Meteor Lake, Mesa 26.2.3), worktree onmaine16b2bc:guest_localepasses with the newCheckStreamWidth(the pair is returned, the returned function sets the width and returns the same stream, flags and precision and the bytes around the object stay untouched, a null stream throws); without the export the test does not link. The title (PPSA21402) starts and renders with the patchedlibc.prx. It later stops withnull or misaligned index basefrom the graphics path, which it also does with the previouslibc.prx, so it is not related to this change. Not tested on Windows.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