diff --git a/bazel/BUILD b/bazel/BUILD index 776798174a..bd6376b085 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -273,6 +273,11 @@ config_setting( values = {"cpu": "mips64"}, ) +config_setting( + name = "linux_s390x", + values = {"cpu": "s390x"}, +) + config_setting( name = "windows_x86_64", values = {"cpu": "x64_windows"}, @@ -351,6 +356,7 @@ alias( ":linux_x86_64": ":linux_x86_64", ":linux_aarch64": ":linux_aarch64", ":linux_ppc": ":linux_ppc", + ":linux_s390x": "linux_s390x", ":linux_mips64": ":linux_mips64", # If we're not on an linux platform return a value that will never match in the select() statement calling this # since it would have already been matched above. diff --git a/bazel/external/wee8.genrule_cmd b/bazel/external/wee8.genrule_cmd index 5a37d85b04..f47af4fc42 100644 --- a/bazel/external/wee8.genrule_cmd +++ b/bazel/external/wee8.genrule_cmd @@ -2,11 +2,14 @@ set -e -# This works only on Linux-x86_64 and macOS-x86_64. -if [[ ( `uname` != "Linux" && `uname` != "Darwin" ) || `uname -m` != "x86_64" ]]; then - echo "ERROR: wee8 is currently supported only on Linux-x86_64 and macOS-x86_64." +# This works only on Linux-{x86_64,ppc64le,s390x,aarch64} and macOS-x86_64. +case "$$(uname -s)-$$(uname -m)" in +Linux-x86_64|Linux-ppc64le|Linux-s390x|Linux-aarch64|Darwin-x86_64) + ;; +*) + echo "ERROR: wee8 is currently supported only on Linux-{x86_64,ppc64le,s390x,aarch64} and macOS-x86_64." >&2 exit 1 -fi +esac # Bazel magic. ROOT=$$(dirname $(rootpath wee8/BUILD.gn))/.. @@ -68,7 +71,7 @@ WEE8_BUILD_ARGS+=" v8_enable_shared_ro_heap=false" # Build wee8. third_party/depot_tools/gn gen out/wee8 --args="$$WEE8_BUILD_ARGS" -third_party/depot_tools/ninja -C out/wee8 wee8 +ninja -C out/wee8 wee8 # Move compiled library to the expected destinations. popd diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 8c32745b41..ddf102d88b 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -812,5 +812,8 @@ def _is_arch(ctxt, arch): def _is_linux_ppc(ctxt): return _is_linux(ctxt) and _is_arch(ctxt, "ppc") +def _is_linux_s390x(ctxt): + return _is_linux(ctxt) and _is_arch(ctxt, "s390x") + def _is_linux_x86_64(ctxt): return _is_linux(ctxt) and _is_arch(ctxt, "x86_64") diff --git a/source/common/api/BUILD b/source/common/api/BUILD index b8b60aab61..08af3f9305 100644 --- a/source/common/api/BUILD +++ b/source/common/api/BUILD @@ -27,6 +27,7 @@ envoy_cc_library( "//bazel:linux_aarch64": ["os_sys_calls_impl_linux.cc"], "//bazel:linux_ppc": ["os_sys_calls_impl_linux.cc"], "//bazel:linux_mips64": ["os_sys_calls_impl_linux.cc"], + "//bazel:linux_s390x": ["os_sys_calls_impl_linux.cc"], "//conditions:default": [], }) + envoy_select_hot_restart(["os_sys_calls_impl_hot_restart.cc"]), hdrs = ["os_sys_calls_impl.h"] + select({ @@ -34,6 +35,7 @@ envoy_cc_library( "//bazel:linux_aarch64": ["os_sys_calls_impl_linux.h"], "//bazel:linux_ppc": ["os_sys_calls_impl_linux.h"], "//bazel:linux_mips64": ["os_sys_calls_impl_linux.h"], + "//bazel:linux_s390x": ["os_sys_calls_impl_linux.h"], "//conditions:default": [], }) + envoy_select_hot_restart(["os_sys_calls_impl_hot_restart.h"]), deps = [ diff --git a/source/common/network/utility.cc b/source/common/network/utility.cc index 667d0ccc99..81d0d8ad90 100644 --- a/source/common/network/utility.cc +++ b/source/common/network/utility.cc @@ -437,17 +437,19 @@ bool Utility::portInRangeList(const Address::Instance& address, const std::list< } absl::uint128 Utility::Ip6ntohl(const absl::uint128& address) { - // TODO(ccaraman): Support Ip6ntohl for big-endian. - static_assert(ABSL_IS_LITTLE_ENDIAN, - "Machines using big-endian byte order is not supported for IPv6."); +#ifdef ABSL_IS_LITTLE_ENDIAN return flipOrder(address); +#else + return address; +#endif } absl::uint128 Utility::Ip6htonl(const absl::uint128& address) { - // TODO(ccaraman): Support Ip6ntohl for big-endian. - static_assert(ABSL_IS_LITTLE_ENDIAN, - "Machines using big-endian byte order is not supported for IPv6."); +#ifdef ABSL_IS_LITTLE_ENDIAN return flipOrder(address); +#else + return address; +#endif } absl::uint128 Utility::flipOrder(const absl::uint128& input) { diff --git a/source/server/BUILD b/source/server/BUILD index a863b2c0ce..f7ff18fbde 100644 --- a/source/server/BUILD +++ b/source/server/BUILD @@ -195,6 +195,7 @@ envoy_cc_library( "//bazel:linux_aarch64": ["options_impl_platform_linux.cc"], "//bazel:linux_ppc": ["options_impl_platform_linux.cc"], "//bazel:linux_mips64": ["options_impl_platform_linux.cc"], + "//bazel:linux_s390x": ["options_impl_platform_linux.cc"], "//conditions:default": ["options_impl_platform_default.cc"], }), hdrs = [ @@ -205,6 +206,7 @@ envoy_cc_library( "//bazel:linux_aarch64": ["options_impl_platform_linux.h"], "//bazel:linux_ppc": ["options_impl_platform_linux.h"], "//bazel:linux_mips64": ["options_impl_platform_linux.h"], + "//bazel:linux_s390x": ["options_impl_platform_linux.h"], "//conditions:default": [], }), # TCLAP command line parser needs this to support int64_t/uint64_t in several build environments.