[libcxx-commits] [PATCH] D158919: [libunwind][WebAssembly] Support Wasm EH

Heejin Ahn via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 25 20:19:40 PDT 2023


aheejin created this revision.
aheejin added reviewers: dschuff, sbc100.
Herald added subscribers: pmatos, asb, wingo, sunfish, jgravelle-google.
Herald added a project: All.
aheejin requested review of this revision.
Herald added projects: LLVM, libunwind.
Herald added subscribers: libcxx-commits, llvm-commits.
Herald added a reviewer: libunwind.

This adds Wasm-specific libunwind port to support Wasm exception
handling (https://github.com/WebAssembly/exception-handling).

Wasm EH requires `__USING_WASM_EXCEPTIONS__` to be defined. This adds
`Unwind-wasm.c`, which defines libunwind APIs for Wasm. This also adds a
`thread_local` struct of type `_Unwind_LandingPadContext`, which serves
as a medium for input/output data between the user code and the
personality function. How all these work is explained in
https://github.com/WebAssembly/tool-conventions/blob/main/EHScheme.md.
(The doc is old and "You Shouldn't Prune Unreachable Resumes" section
doesn't apply anymore, but otherwise it should be good)

The bulk of these changes was added back in Mar 2020 in
https://github.com/emscripten-core/emscripten/pull/10577 to emscripten
repo and has been used ever since. Now we'd like to upstream this so
that other toolchains that don't use emscripten libraries, e.g., WASI,
can use this too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158919

Files:
  libunwind/include/unwind_itanium.h
  libunwind/src/Unwind-wasm.c
  libunwind/src/config.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158919.553695.patch
Type: text/x-patch
Size: 5628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230826/88ada47d/attachment.bin>


More information about the libcxx-commits mailing list