From 17e86fec08e8e3a3fe27dee5e1a4d827f48143cb Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 5 Aug 2025 08:33:10 -0700 Subject: [PATCH] Build C API release artifacts with unwind tables In #11344 it was found that if Wasmtime had a frame on the stack then an application's previous unwinding was broken. This was due to the fact that Wasmtime's C API artifacts do not have unwind information built-in due to being build with `-Cpanic=abort`. This change updates to building the C API artifacts with `-Cforce-unwind-tables` even though Rust itself won't use them to assist with embedders that want to unwind. These should in theory be easily strippable if desired and additionally embedders always have the option to build their own version of the C API too. Closes #11344 --- ci/build-release-artifacts.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ci/build-release-artifacts.sh b/ci/build-release-artifacts.sh index 64f419909d20..de215df7ea0b 100755 --- a/ci/build-release-artifacts.sh +++ b/ci/build-release-artifacts.sh @@ -71,6 +71,12 @@ fi cargo build --release $flags --target $target -p wasmtime-cli $bin_flags --features run +# For the C API force unwind tables to be emitted to make the generated objects +# more flexible. Embedders can always build without this but this enables +# libunwind to produce better backtraces by default when Wasmtime is linked into +# a different project that wants to unwind. +export RUSTFLAGS="$RUSTFLAGS -C force-unwind-tables" + mkdir -p target/c-api-build cd target/c-api-build cmake \