feat(libSceLibcInternal): implement the error category names and codecvt_base queries #15696
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15696"
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 B-Howell on 2026-11-04T07:30:18Z.
What
Implements six
libSceLibcInternalexports that were stubs throwing throughNotImplemented_nid_no_patch. Each mangled name was checked against its NID withtools/nid_names.py'scompute_nid:_ZNKSt22_System_error_category4nameEvdXy+lFOiaQA"system"_ZNKSt23_Generic_error_category4nameEvxvVR0CBPFAM"generic"_ZNKSt24_Iostream_error_category4nameEvsb2vivqtLS0"iostream"_ZNKSt22_Future_error_category4nameEvQ0VsWTapQ4M"future"_ZNKSt12codecvt_base13do_max_lengthEvFOsY+JAyXow1_ZNKSt12codecvt_base11do_encodingEvMwAySqTo+-M1Where the behaviour comes from:
namereturns"generic"and"system", [iostreams.base] gives"iostream"foriostream_category(), and [futures.errors] gives"future"forfuture_category(). The same strings appear in microsoft/STL ate1ed302683e5e822f663fbb0f44cee7e9ddc6af0:stl/inc/system_errorL549return "generic";, L562return "iostream";, L579return "system";, andstl/inc/futureL152return "future";. They also match the existing AnyPS5 guest category vtables inlibc/src/exception/StandardExceptions.cpp(GenericCategoryName_nid_no_patchreturns"generic",SystemCategoryName_nid_no_patchreturns"system"andFutureCategoryName_nid_no_patchreturns"future").codecvt_base: in microsoft/STLstl/inc/xlocaleL608-L615 at the same commit,virtual int __CLR_OR_THIS_CALL do_max_length() const noexceptanddo_encoding() const noexceptbothreturn 1;. This also matches AnyPS5's own codecvt facet inlibc/src/LocaleSupport.cpp, whereCodecvtConstantOnereturns 1 and fills both themax_lengthandencodingslots ofg_codecvtVtable.None of the six functions reads its object. The stubs are removed from
InventoryExports.cpp,InventoryExports2.cppandInventoryExports.hpp, and the new functions are declared once ininclude/Api.hpp. The debt file loses these NIDs from its stub entries and gains one entry for what is still unverified: the console'slibSceLibcInternal.sprxwas not compared and no title was seen calling these exports.Who calls them:
name()is the virtual a program calls to label anerror_category, for example when it prints a code ascategory().name()andvalue().system_error::what()does not read it: microsoft/STL ate1ed302683e5builds the message from_Errcode.message()(stl/inc/system_errorL467-L478). Thecodecvt_basequeries are what a stream asks its codecvt facet formax_lengthandencoding.tools/progress.pycollect_libraries(), currentorigin/main5b1d381d5aagainst this branch merged into it (it merges cleanly):donegoes from 9913 to 9919 (+6) withtotalunchanged at 37146. ForlibSceLibcInternal,donegoes from 92 to 98 andtodofrom 1045 to 1039, so no todo is added.Tested
New guest test
guest_libc_internal_constant_members(core/libs/tests/GuestLibcInternalConstantMembers.cpp). It checks each name string, checks that the result does not depend on the object passed (null, an unrelated object, the real category), compares each name with thenameslot of libc's guestgeneric_category(),system_category()andfuture_category()vtables, and checks that bothcodecvt_basequeries return 1.Windows 11, WinLibs GCC 15.2.0, Release, commit
9cd64b09c8:guest_libc_internal_constant_members,guest_libc_internal_exception_destructorsandpublic_headers(the single-declaration check) were run 3 times; 3/3 passed each time (9/9).Linux, WSL Ubuntu 22.04.1, GCC 11.4.0, Release, same commit: the same 3 tests were run 3 times; 3/3 passed each time (9/9).
The branch is based on
b8efa6292aand merges into currentmain(5b1d381d5a) without conflicts (git merge-tree), so it was not rebased again.Negative control:
main's production files (the stubInventoryExports.cpp,InventoryExports2.cppandInventoryExports.hpp, with no implementation) plus the new test fail to link on both Windows and Linux. All six functions are reported asundefined reference.MSYS_NO_PATHCONV=1 python3 tools/check_conventions.py --base origin/mainwith this title and body printed "All conventions checks passed." Theconventions_*anddebt_splitctest entries are self-tests of the checker scripts and were not run separately.python3 tools/pr_overlap.py --branch feat/lci-errcat-namesprobed 1805 open PRs. No open PR implements these NIDs. Its table lists #13486 under "Same exports" with the oldlibSceLibcInternalInventory_001_nid_no_patchname and the newsceLibcInternalSystemErrorCategoryName_nid_no_patchonly because its base is stale; its own diff touches onlycore/relinker. #14373 and #14834 edit neighbouring lines ininclude/Api.hpp(L123); whichever merges second needs a trivial rebase. It then reported:Manual comparison of those ten PRs plus #14373 and #14834. For each I took its diff (
gh pr diff; for #5021, which is too large for that, thelibSceLibcInternalfile patches from the pull request files API) and searched every added and removed line for the six NIDs, the six mangled names, the six stub names this PR removes andConstantMembers. None has a hit: #5021, #13486, #13778, #13782, #13881, #14085, #14212, #14401, #14837, #14936, #14373 and #14834. So none implements these functions or edits the stub lines this PR removes.No title run.
Independent test evidence
9cd64b09c8:guest_libc_internal_constant_memberspassed 3/3 under WinLibs GCC 15.2 UCRT.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
🤖 Updated with Codex