fix(exceptions): interpose libstdc++ ABI on Linux so the project's own unwinder drives it #14
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14"
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 obelisk-complex on 2026-09-26T20:10:36Z.
Closes #13.
On native Linux, these
.prxshared libraries and their test executables dynamically link real libstdc++/libgcc, so a plainthrowwent through the system's__cxa_throw/_Unwind_RaiseException. That still invoked this project's own__gxx_personality_v0_nid_postfix(the CIE's personality pointer is a raw function address, agnostic to which unwinder is walking the stack), but handed it libgcc's incompatible private_Unwind_Contextlayout, corrupting every fieldPersonality.cppreads and aborting with no exception message.Changes
OwnPersonality()inUnwind.cppnow recognises the bare__gxx_personality_v0wrapper on Linux too (previously Windows-only).Exports.cppexports the real ABI names (__cxa_throw,__cxa_begin_catch/end_catch,__cxa_rethrow,__cxa_allocate/free_exception,__cxa_call_terminate,__cxa_get_exception_ptr,__cxa_current_exception_type,__cxa_init_primary_exception, thestd::terminate/uncaught_exception(s)mangled names, and the core_Unwind_*entry points) through the existingGCC_GLOBAL_ALIASassembler-alias macro rather than new C++ definitions (a plain redefinition under these names conflicts with<cxxabi.h>'s own declarations). This lets ELF symbol interposition make this project's own implementation win process-wide overlibgcc_s.so.1/libstdc++.so.6.__cxa_init_primary_exception_nid_postfixis new: GCC 13's inlinestd::make_exception_ptrcalls__cxa_init_primary_exception, and nothing implemented it before.__dynamic_cast,__cxa_pure_virtualor__cxa_deleted_virtual. Nothing incore/libs/prxneeds them rerouted, and doing so would divert every RTTI cast in libstdc++ and third-party code (SDL2, glslang) through this project's slower walker for no benefit.Testing (Linux, GCC)
ctest: 23/30 -> 30/30. Fixesguest_rendering_wait,guest_buffer_reuse,guest_shader_link,guest_system_exit_parameters,guest_once,guest_memory,guest_search; six of these seven are the same pre-existing failures #7 named.throw std::runtime_error, linked against real libstdc++) and confirmed withgdbthat it crashes the old way on the commit before this fix, and reaches the documented terminate path after it.#ifdef __linux__/#if defined(_WIN32) || defined(__linux__).🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-09-26T20:59:05Z.
Tested on Linux with The Smurfs Dreams (Unreal Engine, on top of #5, see #12). I had worked around the same mixed-runtime problem the opposite way, by making the native
__cxa_*aliases Windows-only. Replacing that with this PR gets the game exactly as far (same draws, first 4 frames presented). Host catches also work now: the GPU worker'scatchhandles a VideoOut "window was closed" exception that previously ended instd::terminate. I've switched #12 to build on this PR.