diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl index b211b457..2d5ef058 100644 --- a/bazel/dependencies.bzl +++ b/bazel/dependencies.bzl @@ -15,11 +15,19 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") load("@proxy_wasm_cpp_host//bazel/cargo:crates.bzl", "proxy_wasm_cpp_host_fetch_remote_crates") load("@rules_python//python:pip.bzl", "pip_install") -load("@rules_rust//rust:repositories.bzl", "rust_repositories") +load("@rules_rust//rust:repositories.bzl", "rust_repositories", "rust_repository_set") def proxy_wasm_cpp_host_dependencies(): protobuf_deps() + rust_repositories() + rust_repository_set( + name = "rust_linux_s390x", + exec_triple = "s390x-unknown-linux-gnu", + extra_target_triples = ["wasm32-unknown-unknown", "wasm32-wasi"], + version = "1.57.0", + ) + proxy_wasm_cpp_host_fetch_remote_crates() pip_install( diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 126a687a..6f781226 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -92,6 +92,7 @@ def proxy_wasm_cpp_host_repositories(): name = "rules_rust", sha256 = "8a2052e8ec707aa04a6b9e72bfc67fea44e915ecab1d2d0a4835ad51c2410c36", strip_prefix = "rules_rust-b16c26ba5faf1c58ebe94582afd20567ce676e6d", + # NOTE: Update Rust version for Linux/s390x in bazel/dependencies.bzl. url = "https://github.com/bazelbuild/rules_rust/archive/b16c26ba5faf1c58ebe94582afd20567ce676e6d.tar.gz", ) diff --git a/bazel/wasm.bzl b/bazel/wasm.bzl index 7a62ccc8..706d47a9 100644 --- a/bazel/wasm.bzl +++ b/bazel/wasm.bzl @@ -77,7 +77,7 @@ wasi_rust_binary_rule = rule( attrs = _wasm_attrs(wasi_rust_transition), ) -def wasm_rust_binary(name, tags = [], wasi = False, signing_key = [], **kwargs): +def wasm_rust_binary(name, tags = [], wasi = False, signing_key = [], rustc_flags = [], **kwargs): wasm_name = "_wasm_" + name.replace(".", "_") kwargs.setdefault("visibility", ["//visibility:public"]) @@ -87,6 +87,11 @@ def wasm_rust_binary(name, tags = [], wasi = False, signing_key = [], **kwargs): crate_type = "cdylib", out_binary = True, tags = ["manual"], + # Rust doesn't distribute rust-lld for Linux/s390x. + rustc_flags = rustc_flags + select({ + "//bazel:linux_s390x": ["-C", "linker=/usr/bin/lld"], + "//conditions:default": [], + }), **kwargs )