[libunwind] [libunwind] Enable wasm target for exceptions (PR #168449)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 17 13:51:34 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libunwind
Author: Yerzhan Zhamashev (yerzham)
<details>
<summary>Changes</summary>
Most minimal changes to enable libunwind to build for wasm by excluding `__wasm__` from the Windows-style __declspec path in config.h and by recognizing wasm in assembly.h to skip the unsupported-target error. This unblocks building an exceptions-enabled wasi-sdk sysroot (see https://github.com/WebAssembly/wasi-sdk/issues/565) and builds on prior attempts including [yamt’s gist](https://gist.github.com/yamt/b699eb2604d2598810a2876ff2ffc8d8), https://github.com/llvm/llvm-project/pull/79667, and https://github.com/llvm/llvm-project/pull/140365.
---
Full diff: https://github.com/llvm/llvm-project/pull/168449.diff
2 Files Affected:
- (modified) libunwind/src/assembly.h (+2)
- (modified) libunwind/src/config.h (+8-7)
``````````diff
diff --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h
index 84c9d526f1d75..9c35b6050a2bf 100644
--- a/libunwind/src/assembly.h
+++ b/libunwind/src/assembly.h
@@ -254,6 +254,8 @@ aliasname: \
#define NO_EXEC_STACK_DIRECTIVE
// clang-format on
+#elif defined(__wasm__)
+
#else
#error Unsupported target
diff --git a/libunwind/src/config.h b/libunwind/src/config.h
index f017403fa2234..73162995f9293 100644
--- a/libunwind/src/config.h
+++ b/libunwind/src/config.h
@@ -75,13 +75,14 @@
#define _LIBUNWIND_EXPORT
#define _LIBUNWIND_HIDDEN
#else
- #if !defined(__ELF__) && !defined(__MACH__) && !defined(_AIX)
- #define _LIBUNWIND_EXPORT __declspec(dllexport)
- #define _LIBUNWIND_HIDDEN
- #else
- #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
- #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
- #endif
+#if !defined(__ELF__) && !defined(__MACH__) && !defined(_AIX) && \
+ !defined(__wasm__)
+#define _LIBUNWIND_EXPORT __declspec(dllexport)
+#define _LIBUNWIND_HIDDEN
+#else
+#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
+#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
+#endif
#endif
#define STR(a) #a
``````````
</details>
https://github.com/llvm/llvm-project/pull/168449
More information about the cfe-commits
mailing list