feat(libc): implement std::__throw_bad_variant_access #7506
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7506"
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 cadenasynyster on 2026-10-18T10:06:02Z.
What
Onimusha: Way of the Sword (PPSA27836 01.000.001) imports
_ZSt26__throw_bad_variant_accessv(NID9G6z-nF6njg) fromlibc. The title's bundledlibc.prxdoes not export it and neither does ours, so on main it stops about 4 s after launch with:This adds
std::__throw_bad_variant_accessnext to_Throw_bad_weak_ptr: astd::bad_variant_accesstype record and vtable deriving fromstd::exception, thrown throughThrowPlain.what()returnsbad_variant_access, the string LLVM libc++ uses (the export carries libc++'s__throw_bad_variant_accessname); the console's string is unverified and recorded indocs/dev/debt/libc.md.ExceptionRuntime.cppchecks it the same way asbad_weak_ptr: the call throws, a hostcatch (const std::bad_variant_access&)catches it, andwhat()matches.Only this one export is missing for the title.
tools/import_audit.pywithout--modulesalso listswcsncpy_s(Slmz4HMpNGs),wcsncat(pA9N3VIgEZ4) andnum_put<char>::_Getcat(hNAh1l09UpA), but the title's ownlibc.prxcontains those three NIDs and only9G6z-nF6njgis absent from it; the loader resolves the bundled module first. (#6144 adds the two wide-string functions for other titles.)Tested
Windows 11 10.0.26200.9711, WinLibs GCC 15.2.0 r7, Release, RTX 5070 Ti (NVIDIA 617.42). This commit on main
b51c65dd1, dump PPSA27836 01.000.001, relinked with--windows,APS5_PLAYGO_UNLISTED_CHUNKS=installed(the dump has no PlayGo metadata).AGC graphics: vkQueueSubmit graphics: Vulkan result -4(the device loss in #6374); the other exited with 0xC0000005 after 186 s, and that log was overwritten before I read it. In earlier runs on the same main with this function plus local copies of the other three, the same load ended once at the #6362 refusal and once at the #6374 device loss (read invalid at 0x5af5000).python tools/check_conventions.py --base origin/mainpasses.ExceptionRuntimetest (it includes<sys/wait.h>, so not built in my Windows/MinGW tree); Linux; macOS.Checklist
main; no other open PR implements the same functions. Overlaps, each in adjacent lines where both sides stay:StandardExceptions.cppwith #6079 (bad_optional_access, the same pattern next tobad_weak_ptr);docs/dev/debt/libc.mdwith #7386 (the neighbouring entry).NotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T10:31:46Z.
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.
main)core/libs/prx/libc/src/exception/StandardExceptions.cppL94, L335, L470docs/dev/debt/libc.mdL96-97docs/dev/debt/libc.mdL96-97Some 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.
docs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/tests/ExceptionRuntime.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdcore/libs/tests/ExceptionRuntime.cppcore/libs/tests/ExceptionRuntime.cppdocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mddocs/dev/debt/libc.mdImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T11:08:37Z.
Progress report (
9caecfd→9f3e867)➖ System libraries: 90.32% (+0.0%, +1 implemented functions)
✅ 1 implemented
_ZSt26__throw_bad_variant_accessv_nid_postfixImported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-18T12:05:42Z.
Linux results, which the description lists as not run. WSL Ubuntu 24.04 (gcc 13.3), Release,
main3e3e8b905plus this PR:exception_runtimepasses (5/5 with--repeat until-fail:5), and so doesexception_personality.main,exception_runtimefails to link:undefined reference to _ZSt26__throw_bad_variant_accessv_nid_postfix.libc.prxexports9G6z-nF6njgon Linux (nm -D) and on Windows/MinGW GCC 15.2.0 (objdump -p), the same NIDnid_names.pygives.AI-assisted: yes (Claude Code); results above were run on this machine.