[libunwind] [libunwind] Enable wasm target for exceptions (PR #168449)
Christof Petig via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 19 05:26:20 PST 2026
================
@@ -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
----------------
cpetig wrote:
`__declspec(dllexport)` is clearly a Windows/MSVC specific way to declare exports while the `visibility(...)` declaration is more portable and should apply to wasm as well (as wasm is neither ELF nor MACH nor AIX)
The first error in wasi-sdk is
`.../wasi-sdk/src/llvm-project/libunwind/src/Unwind-wasm.c:64:1: error: '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes`
https://github.com/llvm/llvm-project/pull/168449
More information about the cfe-commits
mailing list