HendrikHuebner wrote:

> There is also some work to be done to support other personality functions in 
> WebAssembly. Basic code generation with the wrong personality function works 
> with [this](https://github.com/llvm/llvm-project/pull/171038) patch.
> 
>     1. Clang emits `_Unwind_CallPersonality` (defined in 
> [libunwind/src/Unwind-wasm.c](https://github.com/llvm/llvm-project/blob/80ec43d455a5e47ba005112cd2b2c447bb40c42c/libunwind/src/Unwind-wasm.c#L58))
>  which always calls `__gxx_personality_wasm0`.
> 
>     2. WebAssembly catchpads are emitted based on the return value of 
> `isWasmPersonality`.
> 
>     3. WasmEHPrepare hard-codes and reports a fatal error if the personality 
> function is not `__gxx_wasm_personality_v0`
>        
> https://github.com/llvm/llvm-project/blob/80ec43d455a5e47ba005112cd2b2c447bb40c42c/llvm/lib/CodeGen/WasmEHPrepare.cpp#L238-L244
> 
> 
> The personality `__gxx_personality_wasm0` is implemented in 
> [libcxxabi/src/cxa_personality.cpp](https://github.com/llvm/llvm-project/blob/80ec43d455a5e47ba005112cd2b2c447bb40c42c/libcxxabi/src/cxa_personality.cpp#L1019).
> 
> I would like to avoid defining two new personality functions for ObjC and 
> ObjCXX on WASM. Can't we just differentiate and emit code based on the target 
> triple?

 I don't understand why we need `_Unwind_CallPersonality` in the first place, 
since all it does at the moment is delegating to the (hardcoded) personality 
function and resetting the selector (Which could also be done inside the 
personality function). There needs to be more flexibility in the ABI to have 
different personality functions. @dschuff Do you think an ABI break involving 
`_Unwind_CallPersonality` would still be tolerable at this stage, such as 
changing the signature or just avoiding it all together and directly emitting a 
call to the personality function?

https://github.com/llvm/llvm-project/pull/169043
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to