feat(libc): implement the system_error error_code constructor #16004
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16004"
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 fishingpvalues on 2026-11-05T08:44:43Z.
What
libSceLibcInternalexportedoly3wSwEJ2A(_ZNSt12system_errorC2ESt10error_codePKc) as a throwing stub, and the patcher failed withduplicate patched export name: oly3wSwEJ2Awhenever libc stopped exporting libstdc++'s weak copy of that constructor (#15955). This implements the constructor and makes the NID call it:std::system_errorfrom the 16-byteerror_codeand theconst char*message. Theruntime_errorbase follows Dinkumware_Makestr: it takes the message, appends": "only when that message is non-empty, then appendserror_code.message()through the category's guest vtable; the code is stored at offset 16. A null category throwsstd::invalid_argument(the reference would dereference it), and an empty message yields"Invalid argument".--preserve-export-listand the patcher no longer sees two exports with one NID.oly3wSwEJ2Ainventory entry now forwards to the libc constructor throughLibcExceptionConstructSystemError_nid_no_patch, so callers get the object rather than a throw."invalid argument: Invalid argument", the empty-message"Invalid argument", the null-category throw, the stored code and the destructor.The branch was rebased onto current
main4ab649f4d8; the earlier review correction (Dinkumware_Makestr, not libstdc++) is included.Tested
Linux x86-64 (CachyOS, GCC 16.2.1), Release,
BUILD_TESTING=ON, basemain105c9e4d91:guest_ampr_cpp_error_testsandguest_libc_internal_exception_destructors_testswith the full library dependencies.ctest --test-dir build -R '^(guest_ampr_cpp_error|guest_libc_internal_exception_destructors)$' --output-on-failure: 2/2 passed.python3 tools/check_conventions.py --base origin/main: passed.python3 tools/pr_overlap.py --branch pr-16004 --jobs 4: exit 2 only because it cannot confirm sharedApi.hpp/debt files from conflicting PR heads; it reports no same exports.Checklist
main; no other open PR implements this NIDNotImplemented_nid_no_patch).mdfiles or images added to the repository