hmelder wrote: ## Why ObjC can't use its own personality function if there is a wrapper?
Well we cannot just redefine `_Unwind_CallPersonality` in libobjc2 as this would clash with libcxxabi when a Objective-C++ program links against both libobjc2 and libcxxabi. ## Why does ObjC need its own personality function in the first place? libobjc2 currently supports Itanium-based, SEH, and MinGW EH. The oldest implementation, the Itanium-based EH model, has two personality functions: `__gnustep_objc_personality_v0` and `__gnustep_objcxx_personality_v0`. Exceptions in pure Objective-C programs are handled by the first personality function. In Objective-C++, the later personality function instead wraps ObjC exceptions into cxx_exception instances and calls `__gxx_personality_v0`. In this model, all references to C++ runtime functions are weak and only called in a code path that involves a C++ exception. As a result, libobjc2 does not have to link with libcxxabi. But new EH functions `objc_begin_catch`, `objc_end_catch`, `objc_exception_throw`, and `objc_exception_rethrow` need to be defined. Now, I have completely missed that the MinGW implementation just wraps cxx exceptions. In `CGObjCGNU.cpp` we emit calls to `_cxx_begin_catch`/`_cxx_end_catch` and only overwrite `objc_exception_throw`. We can do the same thing on Wasm. ## Whether or how much ObjC can share the current libcxxabi and libunwind implementation. I think it would be a better approach to wrap a cxx_exception object and use the existing Wasm cxx EH infrastructure. With this approach we can keep `_Unwind_CallPersonality` with the downside of always linking against libcxxabi. https://github.com/llvm/llvm-project/pull/175202 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
