https://github.com/yerzham created https://github.com/llvm/llvm-project/pull/168449
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. >From be1d7651c263c62fbaad0bc2d30985283c1bfefd Mon Sep 17 00:00:00 2001 From: Yerzhan Zhamashev <[email protected]> Date: Mon, 17 Nov 2025 23:26:51 +0200 Subject: [PATCH 1/2] libunwind: clang-format config.h --- libunwind/src/config.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libunwind/src/config.h b/libunwind/src/config.h index f017403fa2234..41cc63eac358c 100644 --- a/libunwind/src/config.h +++ b/libunwind/src/config.h @@ -75,13 +75,13 @@ #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) +#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 >From 8baec647c9f3c3d6ae7269ed0b5b28405ca44646 Mon Sep 17 00:00:00 2001 From: Yerzhan Zhamashev <[email protected]> Date: Mon, 17 Nov 2025 23:29:14 +0200 Subject: [PATCH 2/2] libunwind: fix wasm build --- libunwind/src/assembly.h | 2 ++ libunwind/src/config.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) 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 41cc63eac358c..73162995f9293 100644 --- a/libunwind/src/config.h +++ b/libunwind/src/config.h @@ -75,7 +75,8 @@ #define _LIBUNWIND_EXPORT #define _LIBUNWIND_HIDDEN #else -#if !defined(__ELF__) && !defined(__MACH__) && !defined(_AIX) +#if !defined(__ELF__) && !defined(__MACH__) && !defined(_AIX) && \ + !defined(__wasm__) #define _LIBUNWIND_EXPORT __declspec(dllexport) #define _LIBUNWIND_HIDDEN #else _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
