Skip to content

Commit 9fa182a

Browse files
authored
wasmtime: fix build on Linux/s390x. (#229)
Signed-off-by: Piotr Sikora <[email protected]>
1 parent 47c5182 commit 9fa182a

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.github/workflows/cpp.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ jobs:
9292
os: ubuntu-20.04
9393
action: build
9494
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
95+
- name: 'Wasmtime on Linux/s390x'
96+
runtime: 'wasmtime'
97+
os: ubuntu-20.04
98+
action: build
99+
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
95100
- name: 'Wasmtime on macOS/x86_64'
96101
runtime: 'wasmtime'
97102
os: macos-11

bazel/cargo/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ buildrs_additional_deps = [
3636
additional_deps = [
3737
"@proxy_wasm_cpp_host__rustix__0_31_3//:rustix",
3838
]
39+
40+
[package.metadata.raze.crates.wasmtime-runtime.'*']
41+
patches = [
42+
"@proxy_wasm_cpp_host//bazel/cargo:wasmtime.patch",
43+
]
44+
patch_args = ["-p3"]

bazel/cargo/crates.bzl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,12 @@ def proxy_wasm_cpp_host_fetch_remote_crates():
906906
type = "tar.gz",
907907
sha256 = "abc7cd79937edd6e238b337608ebbcaf9c086a8457f01dfd598324f7fa56d81a",
908908
strip_prefix = "wasmtime-runtime-0.33.0",
909+
patches = [
910+
"@proxy_wasm_cpp_host//bazel/cargo:wasmtime.patch",
911+
],
912+
patch_args = [
913+
"-p3",
914+
],
909915
build_file = Label("//bazel/cargo/remote:BUILD.wasmtime-runtime-0.33.0.bazel"),
910916
)
911917

bazel/cargo/wasmtime.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Fix build on s390x. (https://github.com/bytecodealliance/wasmtime/pull/3673)
2+
3+
diff --git a/crates/runtime/src/helpers.c b/crates/runtime/src/helpers.c
4+
index 66b87a150..b036b06a8 100644
5+
--- a/crates/runtime/src/helpers.c
6+
+++ b/crates/runtime/src/helpers.c
7+
@@ -8,10 +8,10 @@
8+
#define platform_longjmp(buf, arg) longjmp(buf, arg)
9+
typedef jmp_buf platform_jmp_buf;
10+
11+
-#elif defined(__clang__) && defined(__aarch64__)
12+
+#elif defined(__clang__) && (defined(__aarch64__) || defined(__s390x__))
13+
14+
-// Clang on aarch64 doesn't support `__builtin_setjmp`, so use `sigsetjmp`
15+
-// from libc.
16+
+// Clang on aarch64 and s390x doesn't support `__builtin_setjmp`, so use
17+
+//`sigsetjmp` from libc.
18+
//
19+
// Note that `sigsetjmp` and `siglongjmp` are used here where possible to
20+
// explicitly pass a 0 argument to `sigsetjmp` that we don't need to preserve

0 commit comments

Comments
 (0)