[all-commits] [llvm/llvm-project] 64907b: fix Wasm exceptions + coop threading + shared libr...

Joel Dice via All-commits all-commits at lists.llvm.org
Mon Sep 28 15:13:20 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 64907b6d3201f1755a149d029b3a65c4e0ee663f
      https://github.com/llvm/llvm-project/commit/64907b6d3201f1755a149d029b3a65c4e0ee663f
  Author: Joel Dice <joel.dice at akamai.com>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M libcxxabi/src/cxa_personality.cpp
    M libunwind/include/unwind_wasm.h
    M libunwind/src/Unwind-wasm.c
    M llvm/include/llvm/IR/RuntimeLibcalls.td
    M llvm/lib/CodeGen/WasmEHPrepare.cpp
    M llvm/test/CodeGen/WebAssembly/eh-lsda.ll
    M llvm/test/CodeGen/WebAssembly/exception-legacy.ll
    M llvm/test/CodeGen/WebAssembly/exception.ll
    M llvm/test/CodeGen/WebAssembly/wasm-eh-prepare.ll

  Log Message:
  -----------
  fix Wasm exceptions + coop threading + shared libraries (#222747)

Prior to this commit, the combination of Wasm exception handling,
cooperative multithreading, and shared libraries was broken.
Specifically, the code generation in `WasmEHPrepare.cpp` involved
direct, cross-library access to `libunwind.so`'s thread-local
`__wasm_lpad_context` variable. However, the ABI used for cooperative
multithreading does not support cross-library access to thread-local
variables.

The solution used here is to add a new `_Unwind_GetWasmLPadContext`
function to `libunwind.so` and use that to get address of the
`__wasm_lpad_context` for the current thread, both in the code generated
by `WasmEHPrepare.cpp` and in the `__gxx_wasm_personality_v0` function
defined in `cxa_personality.cpp`. I've used this strategy
unconditionally for all targets, regardless of whether cooperative
multithreading and/or position-independent are enabled. If desired (e.g.
for performance or code complexity reasons), I could make it conditional
on both of those features being enabled and fall back to using
`__wasm_lpad_context` directly otherwise.

Co-authored-by: Derek Schuff <dschuff at chromium.org>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list