From 013f6264e6df3fcefbcb17bf0012adb753869e86 Mon Sep 17 00:00:00 2001 From: Le Yao <54387247+leyao-daily@users.noreply.github.com> Date: Fri, 19 Mar 2021 08:26:45 +0000 Subject: [PATCH 01/21] Add WAMR for Envoy WASM runtime WebAssembly Micro Runtime (WAMR) is a standalone WebAssembly (WASM) runtime with a small footprint. Envoy support multiple WASM runtime, and WAMR will bring many good feature and performance, so enable WAMR into Envoy. Signed-off-by: Le Yao Signed-off-by: Le Yao <54387247+leyao-daily@users.noreply.github.com> --- bazel/BUILD | 5 ++++ bazel/envoy_build_system.bzl | 2 ++ bazel/envoy_select.bzl | 8 ++++++ bazel/external/proxy_wasm_cpp_host.BUILD | 12 +++++++++ bazel/external/wamr.BUILD | 24 +++++++++++++++++ bazel/repositories.bzl | 7 +++++ bazel/repository_locations.bzl | 15 +++++++++++ .../configuration/other_features/wasm.rst | 3 ++- .../extensions/common/wasm/well_known_names.h | 2 ++ source/extensions/extensions_build_config.bzl | 1 + source/extensions/wasm_runtime/wamr/BUILD | 24 +++++++++++++++++ source/extensions/wasm_runtime/wamr/config.cc | 26 +++++++++++++++++++ .../bootstrap/wasm/wasm_speed_test.cc | 6 +++++ test/extensions/common/wasm/BUILD | 1 + test/extensions/common/wasm/wasm_runtime.cc | 3 +++ test/per_file_coverage.sh | 1 + 16 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 bazel/external/wamr.BUILD create mode 100644 source/extensions/wasm_runtime/wamr/BUILD create mode 100644 source/extensions/wasm_runtime/wamr/config.cc diff --git a/bazel/BUILD b/bazel/BUILD index 98be980f810df..0dc6f348425ac 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -401,6 +401,11 @@ config_setting( values = {"define": "wasm=v8"}, ) +config_setting( + name = "wasm_wamr", + values = {"define": "wasm=wamr"}, +) + config_setting( name = "wasm_wasmtime", values = {"define": "wasm=wasmtime"}, diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index 921e51af68193..bca47af0f85a8 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -24,6 +24,7 @@ load( _envoy_select_wasm_cpp_tests = "envoy_select_wasm_cpp_tests", _envoy_select_wasm_rust_tests = "envoy_select_wasm_rust_tests", _envoy_select_wasm_v8 = "envoy_select_wasm_v8", + _envoy_select_wasm_wamr = "envoy_select_wasm_wamr", _envoy_select_wasm_wasmtime = "envoy_select_wasm_wasmtime", _envoy_select_wasm_wavm = "envoy_select_wasm_wavm", ) @@ -210,6 +211,7 @@ envoy_select_wasm_cpp_tests = _envoy_select_wasm_cpp_tests envoy_select_wasm_rust_tests = _envoy_select_wasm_rust_tests envoy_select_wasm_wavm = _envoy_select_wasm_wavm envoy_select_wasm_wasmtime = _envoy_select_wasm_wasmtime +envoy_select_wasm_wamr = _envoy_select_wasm_wamr envoy_select_wasm_v8 = _envoy_select_wasm_v8 # Binary wrappers (from envoy_binary.bzl) diff --git a/bazel/envoy_select.bzl b/bazel/envoy_select.bzl index a34659b545c61..c1a16005bba56 100644 --- a/bazel/envoy_select.bzl +++ b/bazel/envoy_select.bzl @@ -60,12 +60,20 @@ def envoy_select_wasm_rust_tests(xs): # Selects the given values depending on the Wasm runtimes enabled in the current build. def envoy_select_wasm_v8(xs): return select({ + "@envoy//bazel:wasm_wamr": [], "@envoy//bazel:wasm_wasmtime": [], "@envoy//bazel:wasm_wavm": [], "@envoy//bazel:wasm_none": [], "//conditions:default": xs, }) +# Selects the given values depending on the Wasm runtimes enabled in the current build. +def envoy_select_wasm_wamr(xs): + return select({ + "@envoy//bazel:wasm_wamr": xs, + "//conditions:default": [], + }) + # Selects the given values depending on the Wasm runtimes enabled in the current build. def envoy_select_wasm_wavm(xs): return select({ diff --git a/bazel/external/proxy_wasm_cpp_host.BUILD b/bazel/external/proxy_wasm_cpp_host.BUILD index 148635bc099de..13eaab877e75f 100644 --- a/bazel/external/proxy_wasm_cpp_host.BUILD +++ b/bazel/external/proxy_wasm_cpp_host.BUILD @@ -56,6 +56,18 @@ cc_library( ], ) +cc_library( + name = "wamr_lib", + srcs = glob([ + "src/wamr/*.h", + "src/wamr/*.cc", + ]), + deps = [ + ":common_lib", + "@com_github_wamr//:wamr_lib", + ], +) + cc_library( name = "wavm_lib", srcs = glob([ diff --git a/bazel/external/wamr.BUILD b/bazel/external/wamr.BUILD new file mode 100644 index 0000000000000..c173d506c04a6 --- /dev/null +++ b/bazel/external/wamr.BUILD @@ -0,0 +1,24 @@ +licenses(["notice"]) # Apache 2 + +package(default_visibility = ["//visibility:public"]) + +cc_import( + name = "linklib", + shared_library = "library/linux-classic_interp-multi_module-dbg/libiwasm.so", +) + +cc_library( + name = "headlib", + hdrs = glob(["include/*.h"]), + srcs = glob(["include/*.c"]), + include_prefix = "wamr", +) + +cc_library( + name = "wamr_lib", + defines = ["WASM_WAMR"], + deps = [ + "linklib", + "headlib", + ], +) diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 6a4730ac44a98..54a0bcb61eae6 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -187,6 +187,7 @@ def envoy_dependencies(skip_targets = []): _org_llvm_llvm() _com_github_wavm_wavm() + _com_github_wamr() _com_github_wasmtime() _com_github_wasm_c_api() @@ -937,6 +938,12 @@ def _com_github_wavm_wavm(): actual = "@envoy//bazel/foreign_cc:wavm", ) +def _com_github_wamr(): + external_http_archive( + name = "com_github_wamr", + build_file = "@envoy//bazel/external:wamr.BUILD", + ) + def _com_github_wasmtime(): external_http_archive( name = "com_github_wasmtime", diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 2a8cad76c73da..aa580bbfdcba0 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -704,6 +704,19 @@ REPOSITORY_LOCATIONS_SPEC = dict( extensions = ["envoy.wasm.runtime.wavm"], cpe = "cpe:2.3:a:webassembly_virtual_machine_project:webassembly_virtual_machine:*", ), + com_github_wamr = dict( + project_name = "WAMR", + project_desc = "A standalone runtime with a small footprint for WebAssembly", + project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", + version = "WAMR-01-29-2021", + sha256 = "dbd91f6939cf0645f86b15c2a2ab52f9f54ab3ebaee2c778a40ecd5b7798ab81", + strip_prefix = "wasm-micro-runtime-{version}", + urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], + release_date = "2021-01-29", + use_category = ["dataplane_ext"], + extensions = ["envoy.wasm.runtime.wamr"], + cpe = "N/A", + ), com_github_wasmtime = dict( project_name = "wasmtime", project_desc = "A standalone runtime for WebAssembly", @@ -938,6 +951,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.stat_sinks.wasm", "envoy.wasm.runtime.null", "envoy.wasm.runtime.v8", + "envoy.wasm.runtime.wamr", "envoy.wasm.runtime.wavm", "envoy.wasm.runtime.wasmtime", ], @@ -961,6 +975,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.stat_sinks.wasm", "envoy.wasm.runtime.null", "envoy.wasm.runtime.v8", + "envoy.wasm.runtime.wamr", "envoy.wasm.runtime.wavm", "envoy.wasm.runtime.wasmtime", ], diff --git a/docs/root/configuration/other_features/wasm.rst b/docs/root/configuration/other_features/wasm.rst index bc3c74534a5e7..26fe1330378bd 100644 --- a/docs/root/configuration/other_features/wasm.rst +++ b/docs/root/configuration/other_features/wasm.rst @@ -10,11 +10,12 @@ The following runtimes are supported by Envoy: :widths: 1, 2 envoy.wasm.runtime.v8, "`V8 `_-based runtime" + envoy.wasm.runtime.wamr, "`WAMR `_ runtime" envoy.wasm.runtime.wasmtime, "`Wasmtime `_ runtime" envoy.wasm.runtime.wavm, "`WAVM `_ runtime" envoy.wasm.runtime.null, "Compiled modules linked into Envoy" -Wasmtime and WAVM runtimes are not included in Envoy release image by default. +Wasmtime, WAMR and WAVM runtimes are not included in Envoy release image by default. Wasm runtime emits the following statistics: diff --git a/source/extensions/common/wasm/well_known_names.h b/source/extensions/common/wasm/well_known_names.h index 3904868bba880..03acb7a5f8c0b 100644 --- a/source/extensions/common/wasm/well_known_names.h +++ b/source/extensions/common/wasm/well_known_names.h @@ -15,6 +15,8 @@ namespace Wasm { */ class WasmRuntimeValues { public: + // WAMR (https://github.com/bytecodealliance/wasm-micro-runtime). + const std::string Wamr = "envoy.wasm.runtime.wamr"; // Wasmtime (https://github.com/bytecodealliance/wasmtime). const std::string Wasmtime = "envoy.wasm.runtime.wasmtime"; // WAVM (https://github.com/WAVM/WAVM) Wasm VM. diff --git a/source/extensions/extensions_build_config.bzl b/source/extensions/extensions_build_config.bzl index 616d7714ef79a..15f2d4f48581c 100644 --- a/source/extensions/extensions_build_config.bzl +++ b/source/extensions/extensions_build_config.bzl @@ -243,6 +243,7 @@ EXTENSIONS = { "envoy.wasm.runtime.null": "//source/extensions/wasm_runtime/null:config", "envoy.wasm.runtime.v8": "//source/extensions/wasm_runtime/v8:config", + "envoy.wasm.runtime.wamr": "//source/extensions/wasm_runtime/wamr:config", "envoy.wasm.runtime.wavm": "//source/extensions/wasm_runtime/wavm:config", "envoy.wasm.runtime.wasmtime": "//source/extensions/wasm_runtime/wasmtime:config", diff --git a/source/extensions/wasm_runtime/wamr/BUILD b/source/extensions/wasm_runtime/wamr/BUILD new file mode 100644 index 0000000000000..84c500aeccf66 --- /dev/null +++ b/source/extensions/wasm_runtime/wamr/BUILD @@ -0,0 +1,24 @@ +load( + "//bazel:envoy_build_system.bzl", + "envoy_cc_extension", + "envoy_extension_package", +) +load("//bazel:envoy_select.bzl", "envoy_select_wasm_wamr") + +licenses(["notice"]) # Apache 2 + +envoy_extension_package() + +envoy_cc_extension( + name = "config", + srcs = ["config.cc"], + category = "envoy.wasm.runtime", + security_posture = "unknown", + status = "alpha", + deps = [ + "//include/envoy/registry", + "//source/extensions/common/wasm:wasm_runtime_factory_interface", + ] + envoy_select_wasm_wamr([ + "@proxy_wasm_cpp_host//:wamr_lib", + ]), +) diff --git a/source/extensions/wasm_runtime/wamr/config.cc b/source/extensions/wasm_runtime/wamr/config.cc new file mode 100644 index 0000000000000..3b2ce9bd822b1 --- /dev/null +++ b/source/extensions/wasm_runtime/wamr/config.cc @@ -0,0 +1,26 @@ +#include "envoy/registry/registry.h" + +#include "extensions/common/wasm/wasm_runtime_factory.h" + +#include "include/proxy-wasm/wamr.h" + +namespace Envoy { +namespace Extensions { +namespace Common { +namespace Wasm { + +class WamrRuntimeFactory : public WamrFactory { +public: + WasmVmPtr createWasmVm() override { return proxy_wasm::createWamrVm(); } + + absl::string_view name() override { return "envoy.wasm.runtime.wamr"; } +}; + +#if defined(ENVOY_WASM_WAMR) +REGISTER_FACTORY(WamrRuntimeFactory, WasmRuntimeFactory); +#endif + +} // namespace Wasm +} // namespace Common +} // namespace Extensions +} // namespace Envoy diff --git a/test/extensions/bootstrap/wasm/wasm_speed_test.cc b/test/extensions/bootstrap/wasm/wasm_speed_test.cc index b5f72096de0f0..1733b83340fcd 100644 --- a/test/extensions/bootstrap/wasm/wasm_speed_test.cc +++ b/test/extensions/bootstrap/wasm/wasm_speed_test.cc @@ -91,6 +91,12 @@ static void bmWasmSimpleCallSpeedTest(benchmark::State& state, std::string test, std::string("null")); \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, WasmSpeedTest_##_t, std::string(#_t), \ std::string("wavm")); +#elif defined(ENVOY_WASM_WAMR) +#define B(_t) \ + BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, NullSpeedTest_##_t, std::string(#_t), \ + std::string("null")); \ + BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, WasmSpeedTest_##_t, std::string(#_t), \ + std::string("wamr")); #elif defined(ENVOY_WASM_WASMTIME) #define B(_t) \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, NullSpeedTest_##_t, std::string(#_t), \ diff --git a/test/extensions/common/wasm/BUILD b/test/extensions/common/wasm/BUILD index 4eafd90e53c96..4aebc04c27e1b 100644 --- a/test/extensions/common/wasm/BUILD +++ b/test/extensions/common/wasm/BUILD @@ -92,6 +92,7 @@ envoy_cc_test_library( deps = [ "//source/extensions/wasm_runtime/null:config", "//source/extensions/wasm_runtime/v8:config", + "//source/extensions/wasm_runtime/wamr:config", "//source/extensions/wasm_runtime/wasmtime:config", "//source/extensions/wasm_runtime/wavm:config", ], diff --git a/test/extensions/common/wasm/wasm_runtime.cc b/test/extensions/common/wasm/wasm_runtime.cc index 95711f0e1024b..1ddfa5f123df4 100644 --- a/test/extensions/common/wasm/wasm_runtime.cc +++ b/test/extensions/common/wasm/wasm_runtime.cc @@ -19,6 +19,9 @@ std::vector sandboxRuntimes() { #if defined(ENVOY_WASM_WAVM) runtimes.push_back("wavm"); #endif +#if defined(ENVOY_WASM_WAMR) + runtimes.push_back("wamr"); +#endif #if defined(ENVOY_WASM_WASMTIME) runtimes.push_back("wasmtime"); #endif diff --git a/test/per_file_coverage.sh b/test/per_file_coverage.sh index 0c2278641e766..6427076bb4c97 100755 --- a/test/per_file_coverage.sh +++ b/test/per_file_coverage.sh @@ -57,6 +57,7 @@ declare -a KNOWN_LOW_COVERAGE=( "source/extensions/transport_sockets/tls/private_key:76.9" "source/extensions/transport_sockets/tls:95.0" "source/extensions/wasm_runtime:50.0" +"source/extensions/wasm_runtime/wamr:0.0" # Not enabled in coverage build "source/extensions/wasm_runtime/wasmtime:0.0" # Not enabled in coverage build "source/extensions/wasm_runtime/wavm:0.0" # Not enabled in coverage build "source/extensions/watchdog:85.7" # Death tests within extensions From ad1b66be945251946f8964883b7db86b2e6fda8d Mon Sep 17 00:00:00 2001 From: Le Yao <54387247+leyao-daily@users.noreply.github.com> Date: Wed, 7 Apr 2021 08:18:10 +0000 Subject: [PATCH 02/21] Build WAMR from source code Build from source code based on PROXY-WAMS-CPP-HOST Signed-off-by: Le Yao --- bazel/external/proxy_wasm_cpp_host.BUILD | 2 +- bazel/external/wamr.BUILD | 34 ++++++++++++------------ bazel/repository_locations.bzl | 6 ++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bazel/external/proxy_wasm_cpp_host.BUILD b/bazel/external/proxy_wasm_cpp_host.BUILD index 13eaab877e75f..93431b2533cbe 100644 --- a/bazel/external/proxy_wasm_cpp_host.BUILD +++ b/bazel/external/proxy_wasm_cpp_host.BUILD @@ -64,7 +64,7 @@ cc_library( ]), deps = [ ":common_lib", - "@com_github_wamr//:wamr_lib", + "@com_github_wamr//:libiwasm", ], ) diff --git a/bazel/external/wamr.BUILD b/bazel/external/wamr.BUILD index c173d506c04a6..bd17f6e1f2b24 100644 --- a/bazel/external/wamr.BUILD +++ b/bazel/external/wamr.BUILD @@ -1,24 +1,24 @@ licenses(["notice"]) # Apache 2 -package(default_visibility = ["//visibility:public"]) +load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") -cc_import( - name = "linklib", - shared_library = "library/linux-classic_interp-multi_module-dbg/libiwasm.so", -) +package(default_visibility = ["//visibility:public"]) -cc_library( - name = "headlib", - hdrs = glob(["include/*.h"]), - srcs = glob(["include/*.c"]), - include_prefix = "wamr", +filegroup( + name = "srcs", + srcs = glob(["**"]), + visibility = ["//visibility:public"], ) -cc_library( - name = "wamr_lib", - defines = ["WASM_WAMR"], - deps = [ - "linklib", - "headlib", - ], +cmake( + name = "libiwasm", + cache_entries = { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": "On", + "WAMR_BUILD_AOT": "0", + "WAMR_BUILD_SIMD": "0", + }, + lib_source = ":srcs", + out_shared_libs = ["libiwasm.so"], + working_directory = "product-mini/platforms/linux" ) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index aa580bbfdcba0..2d84421dd71ed 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -709,9 +709,9 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_desc = "A standalone runtime with a small footprint for WebAssembly", project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", version = "WAMR-01-29-2021", - sha256 = "dbd91f6939cf0645f86b15c2a2ab52f9f54ab3ebaee2c778a40ecd5b7798ab81", - strip_prefix = "wasm-micro-runtime-{version}", - urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], + sha256 = "f819b9ec866a12086233e578044dd8297e6be86f0f17807b16124f78a3652d4f", + name = "wamr", + urls = ["https://github.com/lum1n0us/wasm-micro-runtime/releases/download/WAMR-01-29-2021/source.zip"], release_date = "2021-01-29", use_category = ["dataplane_ext"], extensions = ["envoy.wasm.runtime.wamr"], From 4791b2f92d56b43c7f4ac449b74a806a62db70bd Mon Sep 17 00:00:00 2001 From: Le Yao <54387247+leyao-daily@users.noreply.github.com> Date: Fri, 9 Apr 2021 01:27:13 +0000 Subject: [PATCH 03/21] Fix the factory name typo Signed-off-by: Le Yao --- source/extensions/wasm_runtime/wamr/config.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/extensions/wasm_runtime/wamr/config.cc b/source/extensions/wasm_runtime/wamr/config.cc index 3b2ce9bd822b1..5b6afb04a197e 100644 --- a/source/extensions/wasm_runtime/wamr/config.cc +++ b/source/extensions/wasm_runtime/wamr/config.cc @@ -9,7 +9,7 @@ namespace Extensions { namespace Common { namespace Wasm { -class WamrRuntimeFactory : public WamrFactory { +class WamrRuntimeFactory : public WasmRuntimeFactory { public: WasmVmPtr createWasmVm() override { return proxy_wasm::createWamrVm(); } From 2870ce89bd9401467ffa6502262cbb23b1c60a8c Mon Sep 17 00:00:00 2001 From: Le Yao <54387247+leyao-daily@users.noreply.github.com> Date: Fri, 9 Apr 2021 03:18:18 +0000 Subject: [PATCH 04/21] Fix external rules based on envoy version Envoy use a differert foreign_cc rules version Signed-off-by: Le Yao Co-authored-by: Liang He --- bazel/external/wamr.BUILD | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/external/wamr.BUILD b/bazel/external/wamr.BUILD index bd17f6e1f2b24..99be67d3f6988 100644 --- a/bazel/external/wamr.BUILD +++ b/bazel/external/wamr.BUILD @@ -1,6 +1,6 @@ licenses(["notice"]) # Apache 2 -load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") +load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external") package(default_visibility = ["//visibility:public"]) @@ -10,7 +10,7 @@ filegroup( visibility = ["//visibility:public"], ) -cmake( +cmake_external( name = "libiwasm", cache_entries = { "CMAKE_BUILD_TYPE": "Debug", @@ -19,6 +19,6 @@ cmake( "WAMR_BUILD_SIMD": "0", }, lib_source = ":srcs", - out_shared_libs = ["libiwasm.so"], + static_libraries = ["libvmlib.a"], working_directory = "product-mini/platforms/linux" ) From 4d55dacb9511b49dd30f963128b1b03fb7d9eaa7 Mon Sep 17 00:00:00 2001 From: Le Yao <54387247+leyao-daily@users.noreply.github.com> Date: Mon, 12 Apr 2021 06:43:01 +0000 Subject: [PATCH 05/21] Update the WAMR configuration and release version Signed-off-by: Le Yao Co-authored-by: Liang He --- bazel/external/proxy_wasm_cpp_host.BUILD | 3 +++ bazel/external/wamr.BUILD | 2 ++ bazel/repository_locations.bzl | 12 ++++++------ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bazel/external/proxy_wasm_cpp_host.BUILD b/bazel/external/proxy_wasm_cpp_host.BUILD index 93431b2533cbe..b946f10fe46f7 100644 --- a/bazel/external/proxy_wasm_cpp_host.BUILD +++ b/bazel/external/proxy_wasm_cpp_host.BUILD @@ -58,6 +58,9 @@ cc_library( cc_library( name = "wamr_lib", + defines = [ + "ENVOY_WASM_WAMR", + ], srcs = glob([ "src/wamr/*.h", "src/wamr/*.cc", diff --git a/bazel/external/wamr.BUILD b/bazel/external/wamr.BUILD index 99be67d3f6988..35901e5c50843 100644 --- a/bazel/external/wamr.BUILD +++ b/bazel/external/wamr.BUILD @@ -17,6 +17,8 @@ cmake_external( "CMAKE_EXPORT_COMPILE_COMMANDS": "On", "WAMR_BUILD_AOT": "0", "WAMR_BUILD_SIMD": "0", + "WAMR_BUILD_MULTI_MODULE": "1", + "WAMR_BUILD_LIBC_WASI": "0", }, lib_source = ":srcs", static_libraries = ["libvmlib.a"], diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 2d84421dd71ed..bc94d18f61db0 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -705,14 +705,14 @@ REPOSITORY_LOCATIONS_SPEC = dict( cpe = "cpe:2.3:a:webassembly_virtual_machine_project:webassembly_virtual_machine:*", ), com_github_wamr = dict( - project_name = "WAMR", + project_name = "Webassembly Micro Runtime", project_desc = "A standalone runtime with a small footprint for WebAssembly", project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", - version = "WAMR-01-29-2021", - sha256 = "f819b9ec866a12086233e578044dd8297e6be86f0f17807b16124f78a3652d4f", - name = "wamr", - urls = ["https://github.com/lum1n0us/wasm-micro-runtime/releases/download/WAMR-01-29-2021/source.zip"], - release_date = "2021-01-29", + version = "0.1-alpha", + sha256 = "e364c84654121e3b303d380e017540bb1b330845327db3f4d51fa353492ec04f", + strip_prefix = "wasm-micro-runtime-{version}", + urls = ["https://github.com/lum1n0us/wasm-micro-runtime/archive/refs/tags/v{version}.tar.gz"], + release_date = "2020-04-11", use_category = ["dataplane_ext"], extensions = ["envoy.wasm.runtime.wamr"], cpe = "N/A", From 0f646606e7df7cff5263eb7f319f46446ce2ceb3 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Mon, 19 Apr 2021 06:03:21 +0000 Subject: [PATCH 06/21] Fix the pre-check and update version Signed-off-by: Le Yao --- bazel/external/proxy_wasm_cpp_host.BUILD | 6 +++--- bazel/external/wamr.BUILD | 7 +++---- bazel/repository_locations.bzl | 6 +++--- test/extensions/common/wasm/BUILD | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/bazel/external/proxy_wasm_cpp_host.BUILD b/bazel/external/proxy_wasm_cpp_host.BUILD index b946f10fe46f7..a497d8239dfbc 100644 --- a/bazel/external/proxy_wasm_cpp_host.BUILD +++ b/bazel/external/proxy_wasm_cpp_host.BUILD @@ -58,13 +58,13 @@ cc_library( cc_library( name = "wamr_lib", - defines = [ - "ENVOY_WASM_WAMR", - ], srcs = glob([ "src/wamr/*.h", "src/wamr/*.cc", ]), + defines = [ + "ENVOY_WASM_WAMR", + ], deps = [ ":common_lib", "@com_github_wamr//:libiwasm", diff --git a/bazel/external/wamr.BUILD b/bazel/external/wamr.BUILD index 35901e5c50843..d87386a9f71de 100644 --- a/bazel/external/wamr.BUILD +++ b/bazel/external/wamr.BUILD @@ -1,7 +1,7 @@ -licenses(["notice"]) # Apache 2 - load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external") +licenses(["notice"]) # Apache 2 + package(default_visibility = ["//visibility:public"]) filegroup( @@ -13,7 +13,6 @@ filegroup( cmake_external( name = "libiwasm", cache_entries = { - "CMAKE_BUILD_TYPE": "Debug", "CMAKE_EXPORT_COMPILE_COMMANDS": "On", "WAMR_BUILD_AOT": "0", "WAMR_BUILD_SIMD": "0", @@ -22,5 +21,5 @@ cmake_external( }, lib_source = ":srcs", static_libraries = ["libvmlib.a"], - working_directory = "product-mini/platforms/linux" + working_directory = "product-mini/platforms/linux", ) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index bc94d18f61db0..8540cb3c74c87 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -708,7 +708,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Webassembly Micro Runtime", project_desc = "A standalone runtime with a small footprint for WebAssembly", project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", - version = "0.1-alpha", + version = "0.1-beta", sha256 = "e364c84654121e3b303d380e017540bb1b330845327db3f4d51fa353492ec04f", strip_prefix = "wasm-micro-runtime-{version}", urls = ["https://github.com/lum1n0us/wasm-micro-runtime/archive/refs/tags/v{version}.tar.gz"], @@ -951,7 +951,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.stat_sinks.wasm", "envoy.wasm.runtime.null", "envoy.wasm.runtime.v8", - "envoy.wasm.runtime.wamr", + "envoy.wasm.runtime.wamr", "envoy.wasm.runtime.wavm", "envoy.wasm.runtime.wasmtime", ], @@ -975,7 +975,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.stat_sinks.wasm", "envoy.wasm.runtime.null", "envoy.wasm.runtime.v8", - "envoy.wasm.runtime.wamr", + "envoy.wasm.runtime.wamr", "envoy.wasm.runtime.wavm", "envoy.wasm.runtime.wasmtime", ], diff --git a/test/extensions/common/wasm/BUILD b/test/extensions/common/wasm/BUILD index 4aebc04c27e1b..54e6b7a24fcd6 100644 --- a/test/extensions/common/wasm/BUILD +++ b/test/extensions/common/wasm/BUILD @@ -92,7 +92,7 @@ envoy_cc_test_library( deps = [ "//source/extensions/wasm_runtime/null:config", "//source/extensions/wasm_runtime/v8:config", - "//source/extensions/wasm_runtime/wamr:config", + "//source/extensions/wasm_runtime/wamr:config", "//source/extensions/wasm_runtime/wasmtime:config", "//source/extensions/wasm_runtime/wavm:config", ], From 92af1c586b967f723a38811709c1e87014e47d45 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Mon, 19 Apr 2021 22:41:16 -0400 Subject: [PATCH 07/21] Add wamr tests executed in CI Signed-off-by: Le Yao --- ci/do_ci.sh | 3 +++ test/extensions/bootstrap/wasm/wasm_speed_test.cc | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index e832dd61ff31e..344ba576eb741 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -325,6 +325,9 @@ elif [[ "$CI_TARGET" == "bazel.compile_time_options" ]]; then TEST_TARGETS=("${TEST_TARGETS[@]/#\/\//@envoy\/\/}") # Building all the dependencies from scratch to link them against libc++. + echo "Building and testing with wasm=wamr: ${TEST_TARGETS[*]}" + bazel_with_collection test "${BAZEL_BUILD_OPTIONS[@]}" --define wasm=wamr "${COMPILE_TIME_OPTIONS[@]}" -c dbg "${TEST_TARGETS[@]}" --test_tag_filters=-nofips --build_tests_only + echo "Building and testing with wasm=wasmtime: ${TEST_TARGETS[*]}" bazel_with_collection test "${BAZEL_BUILD_OPTIONS[@]}" --define wasm=wasmtime "${COMPILE_TIME_OPTIONS[@]}" -c dbg "${TEST_TARGETS[@]}" --test_tag_filters=-nofips --build_tests_only diff --git a/test/extensions/bootstrap/wasm/wasm_speed_test.cc b/test/extensions/bootstrap/wasm/wasm_speed_test.cc index 1733b83340fcd..db5acab7a2d87 100644 --- a/test/extensions/bootstrap/wasm/wasm_speed_test.cc +++ b/test/extensions/bootstrap/wasm/wasm_speed_test.cc @@ -85,18 +85,18 @@ static void bmWasmSimpleCallSpeedTest(benchmark::State& state, std::string test, std::string("null")); \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, WasmSpeedTest_##_t, std::string(#_t), \ std::string("v8")); -#elif defined(ENVOY_WASM_WAVM) +#elif defined(ENVOY_WASM_WAMR) #define B(_t) \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, NullSpeedTest_##_t, std::string(#_t), \ std::string("null")); \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, WasmSpeedTest_##_t, std::string(#_t), \ - std::string("wavm")); -#elif defined(ENVOY_WASM_WAMR) + std::string("wamr")); +#elif defined(ENVOY_WASM_WAVM) #define B(_t) \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, NullSpeedTest_##_t, std::string(#_t), \ std::string("null")); \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, WasmSpeedTest_##_t, std::string(#_t), \ - std::string("wamr")); + std::string("wavm")); #elif defined(ENVOY_WASM_WASMTIME) #define B(_t) \ BENCHMARK_CAPTURE(bmWasmSimpleCallSpeedTest, NullSpeedTest_##_t, std::string(#_t), \ From b064ed497de194110a7858c5ba78eadd24d8b79b Mon Sep 17 00:00:00 2001 From: Le Yao Date: Tue, 20 Apr 2021 01:17:10 -0400 Subject: [PATCH 08/21] Update the WAMR repo to official and fix format Signed-off-by: Le Yao --- api/envoy/extensions/wasm/v3/wasm.proto | 5 +++++ bazel/external/wamr.BUILD | 2 -- bazel/repository_locations.bzl | 8 ++++---- docs/root/configuration/other_features/wasm.rst | 3 +-- generated_api_shadow/envoy/extensions/wasm/v3/wasm.proto | 5 +++++ tools/spelling/spelling_dictionary.txt | 1 + 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/api/envoy/extensions/wasm/v3/wasm.proto b/api/envoy/extensions/wasm/v3/wasm.proto index 58b5c2130f6dd..35af0cf690c20 100644 --- a/api/envoy/extensions/wasm/v3/wasm.proto +++ b/api/envoy/extensions/wasm/v3/wasm.proto @@ -62,6 +62,11 @@ message VmConfig { // // **envoy.wasm.runtime.v8**: `V8 `_-based WebAssembly runtime. // + // .. _extension_envoy.wasm.runtime.wamr: + // + // **envoy.wasm.runtime.wamr**: `WAMR `_-based WebAssembly runtime. + // This runtime is not enabled in the official build. + // // .. _extension_envoy.wasm.runtime.wavm: // // **envoy.wasm.runtime.wavm**: `WAVM `_-based WebAssembly runtime. diff --git a/bazel/external/wamr.BUILD b/bazel/external/wamr.BUILD index d87386a9f71de..7c04b5490ca9e 100644 --- a/bazel/external/wamr.BUILD +++ b/bazel/external/wamr.BUILD @@ -13,7 +13,6 @@ filegroup( cmake_external( name = "libiwasm", cache_entries = { - "CMAKE_EXPORT_COMPILE_COMMANDS": "On", "WAMR_BUILD_AOT": "0", "WAMR_BUILD_SIMD": "0", "WAMR_BUILD_MULTI_MODULE": "1", @@ -21,5 +20,4 @@ cmake_external( }, lib_source = ":srcs", static_libraries = ["libvmlib.a"], - working_directory = "product-mini/platforms/linux", ) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 8540cb3c74c87..ce5a42ffbd2f0 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -708,11 +708,11 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Webassembly Micro Runtime", project_desc = "A standalone runtime with a small footprint for WebAssembly", project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", - version = "0.1-beta", - sha256 = "e364c84654121e3b303d380e017540bb1b330845327db3f4d51fa353492ec04f", + version = "67fa1602031f5b86d195a3b1d02d331fcb70f299", + sha256 = "1d219d4121badc23b0743af2e7dc7e04348ace309748541deba897709f2d90b6", strip_prefix = "wasm-micro-runtime-{version}", - urls = ["https://github.com/lum1n0us/wasm-micro-runtime/archive/refs/tags/v{version}.tar.gz"], - release_date = "2020-04-11", + urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], + release_date = "2021-04-20", use_category = ["dataplane_ext"], extensions = ["envoy.wasm.runtime.wamr"], cpe = "N/A", diff --git a/docs/root/configuration/other_features/wasm.rst b/docs/root/configuration/other_features/wasm.rst index 26fe1330378bd..bc3c74534a5e7 100644 --- a/docs/root/configuration/other_features/wasm.rst +++ b/docs/root/configuration/other_features/wasm.rst @@ -10,12 +10,11 @@ The following runtimes are supported by Envoy: :widths: 1, 2 envoy.wasm.runtime.v8, "`V8 `_-based runtime" - envoy.wasm.runtime.wamr, "`WAMR `_ runtime" envoy.wasm.runtime.wasmtime, "`Wasmtime `_ runtime" envoy.wasm.runtime.wavm, "`WAVM `_ runtime" envoy.wasm.runtime.null, "Compiled modules linked into Envoy" -Wasmtime, WAMR and WAVM runtimes are not included in Envoy release image by default. +Wasmtime and WAVM runtimes are not included in Envoy release image by default. Wasm runtime emits the following statistics: diff --git a/generated_api_shadow/envoy/extensions/wasm/v3/wasm.proto b/generated_api_shadow/envoy/extensions/wasm/v3/wasm.proto index 58b5c2130f6dd..35af0cf690c20 100644 --- a/generated_api_shadow/envoy/extensions/wasm/v3/wasm.proto +++ b/generated_api_shadow/envoy/extensions/wasm/v3/wasm.proto @@ -62,6 +62,11 @@ message VmConfig { // // **envoy.wasm.runtime.v8**: `V8 `_-based WebAssembly runtime. // + // .. _extension_envoy.wasm.runtime.wamr: + // + // **envoy.wasm.runtime.wamr**: `WAMR `_-based WebAssembly runtime. + // This runtime is not enabled in the official build. + // // .. _extension_envoy.wasm.runtime.wavm: // // **envoy.wasm.runtime.wavm**: `WAVM `_-based WebAssembly runtime. diff --git a/tools/spelling/spelling_dictionary.txt b/tools/spelling/spelling_dictionary.txt index 44481c60f7af5..8fddabb5f6f49 100644 --- a/tools/spelling/spelling_dictionary.txt +++ b/tools/spelling/spelling_dictionary.txt @@ -1241,6 +1241,7 @@ virtualize vptr wakeup wakeups +wamr wasmtime websocket wepoll From 7e609b4141878ec9fff94332dc4913ad0750f3b6 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 30 Apr 2021 02:24:38 +0000 Subject: [PATCH 09/21] Update the Repo dependency to latest WAMR The latest WAMR and Proxy_wasm_cpp_host Signed-off-by: Le Yao --- bazel/repository_locations.bzl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index ce5a42ffbd2f0..99e46068e4faa 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -708,11 +708,11 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Webassembly Micro Runtime", project_desc = "A standalone runtime with a small footprint for WebAssembly", project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", - version = "67fa1602031f5b86d195a3b1d02d331fcb70f299", - sha256 = "1d219d4121badc23b0743af2e7dc7e04348ace309748541deba897709f2d90b6", + version = "9710d9325f426121cc1f2c62386a71d0c022d613", + sha256 = "1d870f396bb6bdcb5c816326655b19a2877bbdf879255c335b8e84ce4ee37780", strip_prefix = "wasm-micro-runtime-{version}", urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], - release_date = "2021-04-20", + release_date = "2021-04-30", use_category = ["dataplane_ext"], extensions = ["envoy.wasm.runtime.wamr"], cpe = "N/A", @@ -962,8 +962,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "WebAssembly for Proxies (C++ host implementation)", project_desc = "WebAssembly for Proxies (C++ host implementation)", project_url = "https://github.com/proxy-wasm/proxy-wasm-cpp-host", - version = "31c75e0039f2f5c42dc6e12556cb151a38da6d8b", - sha256 = "779e7a8e0fd8ed8b3133b464a8e5a9974bdedb345792d3a6148cb5a87e26976b", + version = "f569d10cba74bdfc6f6dfba7a3db94296d313a92", + sha256 = "7bf30ceb7fa2970288147d7507c6766bedea9390fc3f7ac3f6bad1449d2818e1", strip_prefix = "proxy-wasm-cpp-host-{version}", urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-host/archive/{version}.tar.gz"], use_category = ["dataplane_ext"], @@ -979,7 +979,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.wasm.runtime.wavm", "envoy.wasm.runtime.wasmtime", ], - release_date = "2021-05-06", + release_date = "2021-04-30", cpe = "N/A", ), proxy_wasm_rust_sdk = dict( From 1b6bc3954e508bd5c0ec36f42f38758bf859862c Mon Sep 17 00:00:00 2001 From: Liang He Date: Tue, 20 Apr 2021 01:17:10 -0400 Subject: [PATCH 10/21] use envoy_cmake_external to replace cmake_external reorder LLVM libraries to avoid a link error when enabling JIT/AOT: error: undefined reference to 'llvm::DWARFExpression::Operation::extract(llvm::DataExtractor, unsigned short, unsigned char, unsigned long)' Signed-off-by: Liang He --- bazel/external/proxy_wasm_cpp_host.BUILD | 5 +- bazel/external/wamr.BUILD | 23 ------ bazel/foreign_cc/BUILD | 95 +++++++++++++++--------- bazel/repositories.bzl | 6 +- 4 files changed, 65 insertions(+), 64 deletions(-) delete mode 100644 bazel/external/wamr.BUILD diff --git a/bazel/external/proxy_wasm_cpp_host.BUILD b/bazel/external/proxy_wasm_cpp_host.BUILD index a497d8239dfbc..073324b07ac32 100644 --- a/bazel/external/proxy_wasm_cpp_host.BUILD +++ b/bazel/external/proxy_wasm_cpp_host.BUILD @@ -62,12 +62,9 @@ cc_library( "src/wamr/*.h", "src/wamr/*.cc", ]), - defines = [ - "ENVOY_WASM_WAMR", - ], deps = [ ":common_lib", - "@com_github_wamr//:libiwasm", + "@envoy//bazel/foreign_cc:wamr", ], ) diff --git a/bazel/external/wamr.BUILD b/bazel/external/wamr.BUILD deleted file mode 100644 index 7c04b5490ca9e..0000000000000 --- a/bazel/external/wamr.BUILD +++ /dev/null @@ -1,23 +0,0 @@ -load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external") - -licenses(["notice"]) # Apache 2 - -package(default_visibility = ["//visibility:public"]) - -filegroup( - name = "srcs", - srcs = glob(["**"]), - visibility = ["//visibility:public"], -) - -cmake_external( - name = "libiwasm", - cache_entries = { - "WAMR_BUILD_AOT": "0", - "WAMR_BUILD_SIMD": "0", - "WAMR_BUILD_MULTI_MODULE": "1", - "WAMR_BUILD_LIBC_WASI": "0", - }, - lib_source = ":srcs", - static_libraries = ["libvmlib.a"], -) diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index 6d363e72288f1..281ddb2032801 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -231,66 +231,69 @@ envoy_cmake_external( static_libraries = select({ "//conditions:default": [ # Order from llvm-config --libnames. - "libLLVMLTO.a", - "libLLVMPasses.a", - "libLLVMObjCARCOpts.a", + "libLLVMInterpreter.a", + "libLLVMWindowsManifest.a", + "libLLVMLibDriver.a", + "libLLVMObjectYAML.a", + "libLLVMCoverage.a", + "libLLVMLineEditor.a", + "libLLVMDlltoolDriver.a", + "libLLVMOption.a", + "libLLVMTableGen.a", + "libLLVMFuzzMutate.a", "libLLVMSymbolize.a", + "libLLVMCoroutines.a", "libLLVMDebugInfoPDB.a", - "libLLVMDebugInfoDWARF.a", - "libLLVMFuzzMutate.a", - "libLLVMTableGen.a", - "libLLVMDlltoolDriver.a", - "libLLVMLineEditor.a", - "libLLVMOrcJIT.a", - "libLLVMCoverage.a", + "libLLVMLTO.a", + "libLLVMObjCARCOpts.a", "libLLVMMIRParser.a", - "libLLVMObjectYAML.a", - "libLLVMLibDriver.a", - "libLLVMOption.a", - "libLLVMWindowsManifest.a", + "libLLVMOrcJIT.a", + "libLLVMOrcError.a", + "libLLVMJITLink.a", + "libLLVMPasses.a", + "libLLVMipo.a", + "libLLVMInstrumentation.a", + "libLLVMVectorize.a", + "libLLVMLinker.a", + "libLLVMIRReader.a", + "libLLVMAsmParser.a", "libLLVMX86Disassembler.a", "libLLVMX86AsmParser.a", "libLLVMX86CodeGen.a", + "libLLVMCFGuard.a", "libLLVMGlobalISel.a", "libLLVMSelectionDAG.a", "libLLVMAsmPrinter.a", - "libLLVMDebugInfoCodeView.a", - "libLLVMDebugInfoMSF.a", + "libLLVMDebugInfoDWARF.a", + "libLLVMCodeGen.a", + "libLLVMScalarOpts.a", + "libLLVMInstCombine.a", + "libLLVMAggressiveInstCombine.a", + "libLLVMTransformUtils.a", + "libLLVMBitWriter.a", "libLLVMX86Desc.a", "libLLVMMCDisassembler.a", - "libLLVMX86Info.a", "libLLVMX86Utils.a", + "libLLVMX86Info.a", "libLLVMMCJIT.a", - "libLLVMInterpreter.a", "libLLVMExecutionEngine.a", - "libLLVMRuntimeDyld.a", - "libLLVMCodeGen.a", "libLLVMTarget.a", - "libLLVMCoroutines.a", - "libLLVMipo.a", - "libLLVMInstrumentation.a", - "libLLVMVectorize.a", - "libLLVMScalarOpts.a", - "libLLVMLinker.a", - "libLLVMIRReader.a", - "libLLVMAsmParser.a", - "libLLVMInstCombine.a", - "libLLVMTransformUtils.a", - "libLLVMBitWriter.a", "libLLVMAnalysis.a", "libLLVMProfileData.a", + "libLLVMRuntimeDyld.a", "libLLVMObject.a", + "libLLVMTextAPI.a", "libLLVMMCParser.a", - "libLLVMMC.a", "libLLVMBitReader.a", - "libLLVMBitstreamReader.a", + "libLLVMMC.a", + "libLLVMDebugInfoCodeView.a", + "libLLVMDebugInfoMSF.a", "libLLVMCore.a", + "libLLVMRemarks.a", + "libLLVMBitstreamReader.a", "libLLVMBinaryFormat.a", "libLLVMSupport.a", "libLLVMDemangle.a", - "libLLVMRemarks.a", - "libLLVMCFGuard.a", - "libLLVMTextAPI.a", ], }), tags = ["skip_on_windows"], @@ -346,6 +349,26 @@ envoy_cmake_external( deps = [":llvm"], ) +envoy_cmake_external( + name = "wamr", + cache_entries = { + "LLVM_DIR": "$EXT_BUILD_DEPS/copy_llvm/llvm/lib/cmake/llvm", + "WAMR_BUILD_INTERP": "1", + "WAMR_BUILD_JIT": "0", + "WAMR_BUILD_AOT": "0", + "WAMR_BUILD_SIMD": "0", + "WAMR_BUILD_MULTI_MODULE": "1", + "WAMR_BUILD_LIBC_WASI": "0", + "WAMR_BUILD_TAIL_CALL": "1", + }, + defines = ["ENVOY_WASM_WAMR"], + lib_source = "@com_github_wamr//:all", + static_libraries = ["libvmlib.a"], + tags = ["skip_on_windows"], + deps = [":llvm"], + alwayslink = True, +) + envoy_cmake_external( name = "zlib", cache_entries = { diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 54a0bcb61eae6..1eaeed7f859bb 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -941,7 +941,11 @@ def _com_github_wavm_wavm(): def _com_github_wamr(): external_http_archive( name = "com_github_wamr", - build_file = "@envoy//bazel/external:wamr.BUILD", + build_file_content = BUILD_ALL_CONTENT, + ) + native.bind( + name = "wamr", + actual = "@envoy//bazel/foreign_cc:wamr", ) def _com_github_wasmtime(): From 635adb0de6bb94a6df6eaa04cd8a75f04b036c2a Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 30 Apr 2021 06:08:28 +0000 Subject: [PATCH 11/21] Add dependency for wamr to llvm Signed-off-by: Le Yao --- bazel/repository_locations.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 99e46068e4faa..7b19726604647 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -688,7 +688,10 @@ REPOSITORY_LOCATIONS_SPEC = dict( urls = ["https://github.com/llvm/llvm-project/releases/download/llvmorg-{version}/llvm-{version}.src.tar.xz"], release_date = "2020-03-23", use_category = ["dataplane_ext"], - extensions = ["envoy.wasm.runtime.wavm"], + extensions = [ + "envoy.wasm.runtime.wamr", + "envoy.wasm.runtime.wavm", + ], cpe = "cpe:2.3:a:llvm:*:*", ), com_github_wavm_wavm = dict( From dd15bc82b32d7d970ff29b2518fe8e230897b783 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Thu, 6 May 2021 07:04:07 +0000 Subject: [PATCH 12/21] Update the dependency and rebase Signed-off-by: Le Yao --- bazel/repository_locations.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 7b19726604647..3009f9e663ba9 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -965,8 +965,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "WebAssembly for Proxies (C++ host implementation)", project_desc = "WebAssembly for Proxies (C++ host implementation)", project_url = "https://github.com/proxy-wasm/proxy-wasm-cpp-host", - version = "f569d10cba74bdfc6f6dfba7a3db94296d313a92", - sha256 = "7bf30ceb7fa2970288147d7507c6766bedea9390fc3f7ac3f6bad1449d2818e1", + version = "55cdd8efd1264c7d53de01836b84d422f2d1d2df", + sha256 = "e4dc3952cad5b0f205d72a25c9066336390e7784b9be4bdc9c5e839610010eb3", strip_prefix = "proxy-wasm-cpp-host-{version}", urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-host/archive/{version}.tar.gz"], use_category = ["dataplane_ext"], @@ -982,7 +982,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.wasm.runtime.wavm", "envoy.wasm.runtime.wasmtime", ], - release_date = "2021-04-30", + release_date = "2021-05-06", cpe = "N/A", ), proxy_wasm_rust_sdk = dict( From 2b792989071a9d8b5c003a6f6241a6caa30ff30e Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 7 May 2021 03:56:33 +0000 Subject: [PATCH 13/21] Lower wasm_runtime coverage for wamr WAMR is not enabled in coverage build and code is under wasm_runtime Signed-off-by: Le Yao --- test/per_file_coverage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/per_file_coverage.sh b/test/per_file_coverage.sh index 6427076bb4c97..869fed97e1489 100755 --- a/test/per_file_coverage.sh +++ b/test/per_file_coverage.sh @@ -56,7 +56,7 @@ declare -a KNOWN_LOW_COVERAGE=( "source/extensions/transport_sockets/tls/cert_validator:96.5" "source/extensions/transport_sockets/tls/private_key:76.9" "source/extensions/transport_sockets/tls:95.0" -"source/extensions/wasm_runtime:50.0" +"source/extensions/wasm_runtime:40.0" "source/extensions/wasm_runtime/wamr:0.0" # Not enabled in coverage build "source/extensions/wasm_runtime/wasmtime:0.0" # Not enabled in coverage build "source/extensions/wasm_runtime/wavm:0.0" # Not enabled in coverage build From 904e258a22d1e23070ba029750d6a0c81c1d1724 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 7 May 2021 07:26:54 +0000 Subject: [PATCH 14/21] Fix the sort alphabetically and comments Signed-off-by: Le Yao --- bazel/envoy_build_system.bzl | 4 +- bazel/foreign_cc/BUILD | 40 +++++++++---------- bazel/repositories.bzl | 18 ++++----- bazel/repository_locations.bzl | 32 +++++++-------- source/extensions/wasm_runtime/wamr/BUILD | 2 +- source/extensions/wasm_runtime/wasmtime/BUILD | 2 +- source/extensions/wasm_runtime/wavm/BUILD | 2 +- 7 files changed, 50 insertions(+), 50 deletions(-) diff --git a/bazel/envoy_build_system.bzl b/bazel/envoy_build_system.bzl index bca47af0f85a8..f33c92c943df7 100644 --- a/bazel/envoy_build_system.bzl +++ b/bazel/envoy_build_system.bzl @@ -209,10 +209,10 @@ envoy_select_enable_http3 = _envoy_select_enable_http3 envoy_select_hot_restart = _envoy_select_hot_restart envoy_select_wasm_cpp_tests = _envoy_select_wasm_cpp_tests envoy_select_wasm_rust_tests = _envoy_select_wasm_rust_tests +envoy_select_wasm_v8 = _envoy_select_wasm_v8 +envoy_select_wasm_wamr = _envoy_select_wasm_wamr envoy_select_wasm_wavm = _envoy_select_wasm_wavm envoy_select_wasm_wasmtime = _envoy_select_wasm_wasmtime -envoy_select_wasm_wamr = _envoy_select_wasm_wamr -envoy_select_wasm_v8 = _envoy_select_wasm_v8 # Binary wrappers (from envoy_binary.bzl) envoy_cc_binary = _envoy_cc_binary diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index 281ddb2032801..cf5842a526ac4 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -318,6 +318,26 @@ envoy_cmake_external( }), ) +envoy_cmake_external( + name = "wamr", + cache_entries = { + "LLVM_DIR": "$EXT_BUILD_DEPS/copy_llvm/llvm/lib/cmake/llvm", + "WAMR_BUILD_INTERP": "1", + "WAMR_BUILD_JIT": "0", + "WAMR_BUILD_AOT": "0", + "WAMR_BUILD_SIMD": "0", + "WAMR_BUILD_MULTI_MODULE": "1", + "WAMR_BUILD_LIBC_WASI": "0", + "WAMR_BUILD_TAIL_CALL": "1", + }, + defines = ["ENVOY_WASM_WAMR"], + lib_source = "@com_github_wamr//:all", + static_libraries = ["libvmlib.a"], + tags = ["skip_on_windows"], + deps = [":llvm"], + alwayslink = True, +) + envoy_cmake_external( name = "wavm", binaries = ["wavm"], @@ -349,26 +369,6 @@ envoy_cmake_external( deps = [":llvm"], ) -envoy_cmake_external( - name = "wamr", - cache_entries = { - "LLVM_DIR": "$EXT_BUILD_DEPS/copy_llvm/llvm/lib/cmake/llvm", - "WAMR_BUILD_INTERP": "1", - "WAMR_BUILD_JIT": "0", - "WAMR_BUILD_AOT": "0", - "WAMR_BUILD_SIMD": "0", - "WAMR_BUILD_MULTI_MODULE": "1", - "WAMR_BUILD_LIBC_WASI": "0", - "WAMR_BUILD_TAIL_CALL": "1", - }, - defines = ["ENVOY_WASM_WAMR"], - lib_source = "@com_github_wamr//:all", - static_libraries = ["libvmlib.a"], - tags = ["skip_on_windows"], - deps = [":llvm"], - alwayslink = True, -) - envoy_cmake_external( name = "zlib", cache_entries = { diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 1eaeed7f859bb..89ce847384d32 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -186,8 +186,8 @@ def envoy_dependencies(skip_targets = []): _kafka_deps() _org_llvm_llvm() - _com_github_wavm_wavm() _com_github_wamr() + _com_github_wavm_wavm() _com_github_wasmtime() _com_github_wasm_c_api() @@ -928,24 +928,24 @@ def _org_llvm_llvm(): actual = "@envoy//bazel/foreign_cc:llvm", ) -def _com_github_wavm_wavm(): +def _com_github_wamr(): external_http_archive( - name = "com_github_wavm_wavm", + name = "com_github_wamr", build_file_content = BUILD_ALL_CONTENT, ) native.bind( - name = "wavm", - actual = "@envoy//bazel/foreign_cc:wavm", + name = "wamr", + actual = "@envoy//bazel/foreign_cc:wamr", ) -def _com_github_wamr(): +def _com_github_wavm_wavm(): external_http_archive( - name = "com_github_wamr", + name = "com_github_wavm_wavm", build_file_content = BUILD_ALL_CONTENT, ) native.bind( - name = "wamr", - actual = "@envoy//bazel/foreign_cc:wamr", + name = "wavm", + actual = "@envoy//bazel/foreign_cc:wavm", ) def _com_github_wasmtime(): diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 3009f9e663ba9..9fcf9ecab9be8 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -694,19 +694,6 @@ REPOSITORY_LOCATIONS_SPEC = dict( ], cpe = "cpe:2.3:a:llvm:*:*", ), - com_github_wavm_wavm = dict( - project_name = "WAVM", - project_desc = "WebAssembly Virtual Machine", - project_url = "https://wavm.github.io", - version = "79c3aa29366615d9b1593cd527e5b4b94cc6072a", - sha256 = "ce899269516313b400005a8cc9bc3bcd8329663f43f7b4baae211ea0cd456a39", - strip_prefix = "WAVM-{version}", - urls = ["https://github.com/WAVM/WAVM/archive/{version}.tar.gz"], - release_date = "2021-03-31", - use_category = ["dataplane_ext"], - extensions = ["envoy.wasm.runtime.wavm"], - cpe = "cpe:2.3:a:webassembly_virtual_machine_project:webassembly_virtual_machine:*", - ), com_github_wamr = dict( project_name = "Webassembly Micro Runtime", project_desc = "A standalone runtime with a small footprint for WebAssembly", @@ -720,6 +707,19 @@ REPOSITORY_LOCATIONS_SPEC = dict( extensions = ["envoy.wasm.runtime.wamr"], cpe = "N/A", ), + com_github_wavm_wavm = dict( + project_name = "WAVM", + project_desc = "WebAssembly Virtual Machine", + project_url = "https://wavm.github.io", + version = "79c3aa29366615d9b1593cd527e5b4b94cc6072a", + sha256 = "ce899269516313b400005a8cc9bc3bcd8329663f43f7b4baae211ea0cd456a39", + strip_prefix = "WAVM-{version}", + urls = ["https://github.com/WAVM/WAVM/archive/{version}.tar.gz"], + release_date = "2021-03-31", + use_category = ["dataplane_ext"], + extensions = ["envoy.wasm.runtime.wavm"], + cpe = "cpe:2.3:a:webassembly_virtual_machine_project:webassembly_virtual_machine:*", + ), com_github_wasmtime = dict( project_name = "wasmtime", project_desc = "A standalone runtime for WebAssembly", @@ -965,8 +965,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "WebAssembly for Proxies (C++ host implementation)", project_desc = "WebAssembly for Proxies (C++ host implementation)", project_url = "https://github.com/proxy-wasm/proxy-wasm-cpp-host", - version = "55cdd8efd1264c7d53de01836b84d422f2d1d2df", - sha256 = "e4dc3952cad5b0f205d72a25c9066336390e7784b9be4bdc9c5e839610010eb3", + version = "e641ffa8893477cdb4720f572f50f003cd51a083", + sha256 = "20abaa0ff37b3765111fb81774bf4fa4630e23dc9c468b42016c4ebf4f27a38a", strip_prefix = "proxy-wasm-cpp-host-{version}", urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-host/archive/{version}.tar.gz"], use_category = ["dataplane_ext"], @@ -982,7 +982,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( "envoy.wasm.runtime.wavm", "envoy.wasm.runtime.wasmtime", ], - release_date = "2021-05-06", + release_date = "2021-05-07", cpe = "N/A", ), proxy_wasm_rust_sdk = dict( diff --git a/source/extensions/wasm_runtime/wamr/BUILD b/source/extensions/wasm_runtime/wamr/BUILD index 84c500aeccf66..4e000d62752ad 100644 --- a/source/extensions/wasm_runtime/wamr/BUILD +++ b/source/extensions/wasm_runtime/wamr/BUILD @@ -13,7 +13,7 @@ envoy_cc_extension( name = "config", srcs = ["config.cc"], category = "envoy.wasm.runtime", - security_posture = "unknown", + security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status = "alpha", deps = [ "//include/envoy/registry", diff --git a/source/extensions/wasm_runtime/wasmtime/BUILD b/source/extensions/wasm_runtime/wasmtime/BUILD index 47923bd0caa34..8b20b8d069138 100644 --- a/source/extensions/wasm_runtime/wasmtime/BUILD +++ b/source/extensions/wasm_runtime/wasmtime/BUILD @@ -13,7 +13,7 @@ envoy_cc_extension( name = "config", srcs = ["config.cc"], category = "envoy.wasm.runtime", - security_posture = "unknown", + security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status = "alpha", deps = [ "//include/envoy/registry", diff --git a/source/extensions/wasm_runtime/wavm/BUILD b/source/extensions/wasm_runtime/wavm/BUILD index f2b8c69ae785d..3b6397258d5b1 100644 --- a/source/extensions/wasm_runtime/wavm/BUILD +++ b/source/extensions/wasm_runtime/wavm/BUILD @@ -13,7 +13,7 @@ envoy_cc_extension( name = "config", srcs = ["config.cc"], category = "envoy.wasm.runtime", - security_posture = "unknown", + security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status = "alpha", deps = [ "//include/envoy/registry", From 4af6ab8412a3bcb0d186ac4f9472d0a3d48c81c5 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 7 May 2021 03:58:39 -0400 Subject: [PATCH 15/21] Fix comments format Signed-off-by: Le Yao --- source/extensions/wasm_runtime/wamr/BUILD | 2 +- source/extensions/wasm_runtime/wasmtime/BUILD | 2 +- source/extensions/wasm_runtime/wavm/BUILD | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/extensions/wasm_runtime/wamr/BUILD b/source/extensions/wasm_runtime/wamr/BUILD index 4e000d62752ad..21df176ec156e 100644 --- a/source/extensions/wasm_runtime/wamr/BUILD +++ b/source/extensions/wasm_runtime/wamr/BUILD @@ -13,7 +13,7 @@ envoy_cc_extension( name = "config", srcs = ["config.cc"], category = "envoy.wasm.runtime", - security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". + security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status = "alpha", deps = [ "//include/envoy/registry", diff --git a/source/extensions/wasm_runtime/wasmtime/BUILD b/source/extensions/wasm_runtime/wasmtime/BUILD index 8b20b8d069138..b77fd669db5fb 100644 --- a/source/extensions/wasm_runtime/wasmtime/BUILD +++ b/source/extensions/wasm_runtime/wasmtime/BUILD @@ -13,7 +13,7 @@ envoy_cc_extension( name = "config", srcs = ["config.cc"], category = "envoy.wasm.runtime", - security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". + security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status = "alpha", deps = [ "//include/envoy/registry", diff --git a/source/extensions/wasm_runtime/wavm/BUILD b/source/extensions/wasm_runtime/wavm/BUILD index 3b6397258d5b1..bf0fa3f658f6c 100644 --- a/source/extensions/wasm_runtime/wavm/BUILD +++ b/source/extensions/wasm_runtime/wavm/BUILD @@ -13,7 +13,7 @@ envoy_cc_extension( name = "config", srcs = ["config.cc"], category = "envoy.wasm.runtime", - security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". + security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status = "alpha", deps = [ "//include/envoy/registry", From af5cc1945d16a6ff80120eefd107bf5e389eb8a3 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 7 May 2021 11:10:20 +0000 Subject: [PATCH 16/21] Integrate the document changes Signed-off-by: Le Yao --- docs/root/configuration/other_features/wasm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/root/configuration/other_features/wasm.rst b/docs/root/configuration/other_features/wasm.rst index bc3c74534a5e7..f34146e68138e 100644 --- a/docs/root/configuration/other_features/wasm.rst +++ b/docs/root/configuration/other_features/wasm.rst @@ -10,11 +10,12 @@ The following runtimes are supported by Envoy: :widths: 1, 2 envoy.wasm.runtime.v8, "`V8 `_-based runtime" + envoy.wasm.runtime.wamr, "`WAMR `_ runtime" envoy.wasm.runtime.wasmtime, "`Wasmtime `_ runtime" envoy.wasm.runtime.wavm, "`WAVM `_ runtime" envoy.wasm.runtime.null, "Compiled modules linked into Envoy" -Wasmtime and WAVM runtimes are not included in Envoy release image by default. +WAMR(WASM-Micro-Runtime), Wasmtime and WAVM runtimes are not included in Envoy release image by default. Wasm runtime emits the following statistics: From 7f0f52285eaa5ac12ef92ca739b8ecd5e2a00fa6 Mon Sep 17 00:00:00 2001 From: Liang He Date: Wed, 12 May 2021 18:44:48 +0800 Subject: [PATCH 17/21] Enable WMAR JIT mode - generate llvm libraries list with "llvm-config --libnames" ``` $ llvm-config --version 10.0.0 $ llvm-config --libnames asmparser core debuginfodwarf engine lto mcparser mirparser orcjit passes runtimedyld support x86asmparser x86desc ``` - change WAMR default mode to JIT. - change to latest bytecodealliance/wasm-micro-runtime commits Signed-off-by: Liang He --- bazel/foreign_cc/BUILD | 31 ++++++++++--------------------- bazel/repository_locations.bzl | 4 ++-- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index cf5842a526ac4..40b1f8a616d9b 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -230,33 +230,21 @@ envoy_cmake_external( lib_source = "@org_llvm_llvm//:all", static_libraries = select({ "//conditions:default": [ - # Order from llvm-config --libnames. - "libLLVMInterpreter.a", - "libLLVMWindowsManifest.a", - "libLLVMLibDriver.a", - "libLLVMObjectYAML.a", - "libLLVMCoverage.a", - "libLLVMLineEditor.a", - "libLLVMDlltoolDriver.a", - "libLLVMOption.a", - "libLLVMTableGen.a", - "libLLVMFuzzMutate.a", - "libLLVMSymbolize.a", - "libLLVMCoroutines.a", - "libLLVMDebugInfoPDB.a", - "libLLVMLTO.a", - "libLLVMObjCARCOpts.a", - "libLLVMMIRParser.a", + # Order from llvm-config --libnames asmparser core debuginfodwarf + # engine lto mcparser mirparser orcjit passes runtimedyld + # support x86asmparser x86desc "libLLVMOrcJIT.a", "libLLVMOrcError.a", "libLLVMJITLink.a", + "libLLVMMIRParser.a", + "libLLVMLTO.a", "libLLVMPasses.a", + "libLLVMObjCARCOpts.a", "libLLVMipo.a", "libLLVMInstrumentation.a", "libLLVMVectorize.a", "libLLVMLinker.a", "libLLVMIRReader.a", - "libLLVMAsmParser.a", "libLLVMX86Disassembler.a", "libLLVMX86AsmParser.a", "libLLVMX86CodeGen.a", @@ -264,7 +252,6 @@ envoy_cmake_external( "libLLVMGlobalISel.a", "libLLVMSelectionDAG.a", "libLLVMAsmPrinter.a", - "libLLVMDebugInfoDWARF.a", "libLLVMCodeGen.a", "libLLVMScalarOpts.a", "libLLVMInstCombine.a", @@ -281,13 +268,15 @@ envoy_cmake_external( "libLLVMAnalysis.a", "libLLVMProfileData.a", "libLLVMRuntimeDyld.a", + "libLLVMDebugInfoDWARF.a", "libLLVMObject.a", "libLLVMTextAPI.a", "libLLVMMCParser.a", - "libLLVMBitReader.a", "libLLVMMC.a", "libLLVMDebugInfoCodeView.a", "libLLVMDebugInfoMSF.a", + "libLLVMBitReader.a", + "libLLVMAsmParser.a", "libLLVMCore.a", "libLLVMRemarks.a", "libLLVMBitstreamReader.a", @@ -297,6 +286,7 @@ envoy_cmake_external( ], }), tags = ["skip_on_windows"], + alwayslink = True, ) envoy_cmake_external( @@ -335,7 +325,6 @@ envoy_cmake_external( static_libraries = ["libvmlib.a"], tags = ["skip_on_windows"], deps = [":llvm"], - alwayslink = True, ) envoy_cmake_external( diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 9fcf9ecab9be8..329faa314863e 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -698,8 +698,8 @@ REPOSITORY_LOCATIONS_SPEC = dict( project_name = "Webassembly Micro Runtime", project_desc = "A standalone runtime with a small footprint for WebAssembly", project_url = "https://github.com/bytecodealliance/wasm-micro-runtime", - version = "9710d9325f426121cc1f2c62386a71d0c022d613", - sha256 = "1d870f396bb6bdcb5c816326655b19a2877bbdf879255c335b8e84ce4ee37780", + version = "a14a4487bb8b493bf6c68d83b03f12028d16f58a", + sha256 = "d68668e129f16a9ddd7a1a0da22b17905a25001ae2de398726d37880b61fee9e", strip_prefix = "wasm-micro-runtime-{version}", urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], release_date = "2021-04-30", From 1eaf38fbfa3ddb794c857751ad513dd90ac78b24 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Thu, 20 May 2021 06:27:36 +0000 Subject: [PATCH 18/21] Enable JIT and fix date errors Signed-off-by: Le Yao --- bazel/foreign_cc/BUILD | 4 ++-- bazel/repository_locations.bzl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bazel/foreign_cc/BUILD b/bazel/foreign_cc/BUILD index 40b1f8a616d9b..fa982c8bdb25c 100644 --- a/bazel/foreign_cc/BUILD +++ b/bazel/foreign_cc/BUILD @@ -231,8 +231,8 @@ envoy_cmake_external( static_libraries = select({ "//conditions:default": [ # Order from llvm-config --libnames asmparser core debuginfodwarf - # engine lto mcparser mirparser orcjit passes runtimedyld - # support x86asmparser x86desc + # engine lto mcparser mirparser orcjit passes runtimedyld + # support x86asmparser x86desc "libLLVMOrcJIT.a", "libLLVMOrcError.a", "libLLVMJITLink.a", diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 5b8a7fdda2780..0c88e7095013b 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -702,7 +702,7 @@ REPOSITORY_LOCATIONS_SPEC = dict( sha256 = "d68668e129f16a9ddd7a1a0da22b17905a25001ae2de398726d37880b61fee9e", strip_prefix = "wasm-micro-runtime-{version}", urls = ["https://github.com/bytecodealliance/wasm-micro-runtime/archive/{version}.tar.gz"], - release_date = "2021-04-30", + release_date = "2021-05-14", use_category = ["dataplane_ext"], extensions = ["envoy.wasm.runtime.wamr"], cpe = "N/A", From b7e910e8f64a455afb9bda27d676f75a51a10f82 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 28 May 2021 02:23:35 +0000 Subject: [PATCH 19/21] Add wamr runtime metadata Signed-off-by: Le Yao --- source/extensions/extensions_metadata.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/extensions/extensions_metadata.yaml b/source/extensions/extensions_metadata.yaml index 56570a9404282..5f3dd56fb43a1 100644 --- a/source/extensions/extensions_metadata.yaml +++ b/source/extensions/extensions_metadata.yaml @@ -664,6 +664,11 @@ envoy.wasm.runtime.v8: - envoy.wasm.runtime security_posture: unknown status: alpha +envoy.wasm.runtime.wamr: + categories: + - envoy.wasm.runtime + security_posture: unknown + status: alpha envoy.wasm.runtime.wasmtime: categories: - envoy.wasm.runtime From 49e1784b9c7af1e7bba01f6868982d8b904ecbad Mon Sep 17 00:00:00 2001 From: Le Yao Date: Fri, 28 May 2021 06:17:17 +0000 Subject: [PATCH 20/21] Conflict fixed based on main Signed-off-by: Le Yao --- source/extensions/wasm_runtime/wamr/BUILD | 3 --- 1 file changed, 3 deletions(-) diff --git a/source/extensions/wasm_runtime/wamr/BUILD b/source/extensions/wasm_runtime/wamr/BUILD index 21df176ec156e..69766fad9e4ce 100644 --- a/source/extensions/wasm_runtime/wamr/BUILD +++ b/source/extensions/wasm_runtime/wamr/BUILD @@ -12,9 +12,6 @@ envoy_extension_package() envoy_cc_extension( name = "config", srcs = ["config.cc"], - category = "envoy.wasm.runtime", - security_posture = "unknown", # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". - status = "alpha", deps = [ "//include/envoy/registry", "//source/extensions/common/wasm:wasm_runtime_factory_interface", From 86420beca23fad7da417d7b1b12f6f3e80371b43 Mon Sep 17 00:00:00 2001 From: Le Yao Date: Sat, 29 May 2021 01:18:44 +0000 Subject: [PATCH 21/21] Add the unknown security posture comments Signed-off-by: Le Yao --- source/extensions/extensions_metadata.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/extensions/extensions_metadata.yaml b/source/extensions/extensions_metadata.yaml index 5f3dd56fb43a1..ced4fb8ce43f9 100644 --- a/source/extensions/extensions_metadata.yaml +++ b/source/extensions/extensions_metadata.yaml @@ -667,17 +667,17 @@ envoy.wasm.runtime.v8: envoy.wasm.runtime.wamr: categories: - envoy.wasm.runtime - security_posture: unknown + security_posture: unknown # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status: alpha envoy.wasm.runtime.wasmtime: categories: - envoy.wasm.runtime - security_posture: unknown + security_posture: unknown # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status: alpha envoy.wasm.runtime.wavm: categories: - envoy.wasm.runtime - security_posture: unknown + security_posture: unknown # "This may never change from unknown until the threat model at https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/security/threat_model#core-and-extensions is updated to capture additional Wasm runtimes". status: alpha envoy.watchdog.profile_action: categories: