Skip to content

wasmtime: fix build on Linux/s390x. #229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ jobs:
os: ubuntu-20.04
action: build
run_under: docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/arm64 piotrsikora/build-tools:bazel-4.2.2-clang-13-gcc-11
- name: 'Wasmtime on Linux/s390x'
runtime: 'wasmtime'
os: ubuntu-20.04
action: build
run_under: docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/s390x piotrsikora/build-tools:bazel-4.2.2-clang-13-gcc-11
- name: 'Wasmtime on macOS/x86_64'
runtime: 'wasmtime'
os: macos-11
Expand Down
6 changes: 6 additions & 0 deletions bazel/cargo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,9 @@ buildrs_additional_deps = [
additional_deps = [
"@proxy_wasm_cpp_host__rustix__0_31_3//:rustix",
]

[package.metadata.raze.crates.wasmtime-runtime.'*']
patches = [
"@proxy_wasm_cpp_host//bazel/cargo:wasmtime.patch",
]
patch_args = ["-p3"]
6 changes: 6 additions & 0 deletions bazel/cargo/crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,12 @@ def proxy_wasm_cpp_host_fetch_remote_crates():
type = "tar.gz",
sha256 = "abc7cd79937edd6e238b337608ebbcaf9c086a8457f01dfd598324f7fa56d81a",
strip_prefix = "wasmtime-runtime-0.33.0",
patches = [
"@proxy_wasm_cpp_host//bazel/cargo:wasmtime.patch",
],
patch_args = [
"-p3",
],
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-runtime-0.33.0.bazel"),
)

Expand Down
20 changes: 20 additions & 0 deletions bazel/cargo/wasmtime.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Fix build on s390x. (https://github.com/bytecodealliance/wasmtime/pull/3673)

diff --git a/crates/runtime/src/helpers.c b/crates/runtime/src/helpers.c
index 66b87a150..b036b06a8 100644
--- a/crates/runtime/src/helpers.c
+++ b/crates/runtime/src/helpers.c
@@ -8,10 +8,10 @@
#define platform_longjmp(buf, arg) longjmp(buf, arg)
typedef jmp_buf platform_jmp_buf;

-#elif defined(__clang__) && defined(__aarch64__)
+#elif defined(__clang__) && (defined(__aarch64__) || defined(__s390x__))

-// Clang on aarch64 doesn't support `__builtin_setjmp`, so use `sigsetjmp`
-// from libc.
+// Clang on aarch64 and s390x doesn't support `__builtin_setjmp`, so use
+//`sigsetjmp` from libc.
//
// Note that `sigsetjmp` and `siglongjmp` are used here where possible to
// explicitly pass a 0 argument to `sigsetjmp` that we don't need to preserve