fix(libc): export the remaining exception entry points natively on Windows #2615
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2615"
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 oneandonlydean on 2026-10-10T08:27:57Z.
Carrying @AlxcBTW's fix for #2597 while PR intake is paused. The change is theirs (from
AlxcBTW/AnyPS5:fix/libc-native-exception-exports-v2, 400fce30).What
__cxa_init_primary_exception,std::uncaught_exceptionandstd::uncaught_exceptionsunder their native names too, next to__cxa_throw,__cxa_begin_catchand the rest.__cxa_init_primary_exceptionsets the reference count to 0, as the Itanium ABI, libstdc++ and libc++abi do.Why
GCC_GLOBAL_ALIASis empty on Windows, so these three were exported only as_nid_postfixsymbols and host modules (libSceAgcDriver.prx,libSceVideoOut.prx,libkernel.prx) bound libstdc++-6.dll's versions instead. This is the same class of problem as #2540, fixed in #2570.std::uncaught_exceptions()read libstdc++'s thread state, which libc's throws never touch, so it returned 0 during unwinding andrecordDeferredLabels' guard could not tell a failed record from a finished one.std::make_exception_ptrallocated with libc and initialized with libstdc++'s__cxa_init_primary_exception, whose header layout differs. Rethrowing such an exception dies with0xc0000005.exception_ptrcreated next added a second reference and a made exception was never destroyed.Tested
c72d5ce1passed; ond5c8e42dLinux and macOS pass, and the one Windows failure (agc_driver_prepared_shaders_deferred_undecodable) fails on everymainrun at the moment.windows_exceptionsgains two cases: a made, rethrown and released exception destroys its argument and stored copy once each, andstd::uncaught_exceptions()is 1 in a destructor that runs during unwinding. Without the change it dies with0xc0000005; with only the exports it fails withmade exception destroyed an incorrect number of times.exception_runtime(Linux/macOS) gains the same made-exception check.patched_librariesloads every patched library.tools/check_conventions.pypasses, and the branch merges cleanly with currentmain.Fixes #2597
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:42:22Z.
Checked the build and ctest for libc/libs on Linux (57 tests green);
exception_runtimefails without the change and passes with it. The Windows side (windows_exceptions) is covered by @Yuva1024's full ctest run on Windows 11 (658/658). Merging once CI is green.