Skip to content

wamr: update to v1.2.1 (with LLVM v15.0.7). #339

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 1 commit into from
Apr 26, 2023
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
4 changes: 2 additions & 2 deletions bazel/external/wamr.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cmake(
"-GNinja",
] + select({
"@proxy_wasm_cpp_host//bazel:engine_wamr_jit": [
"-DLLVM_DIR=$EXT_BUILD_DEPS/copy_llvm_13_0_1/llvm/lib/cmake/llvm",
"-DLLVM_DIR=$EXT_BUILD_DEPS/copy_llvm-15_0_7/llvm/lib/cmake/llvm",
"-DWAMR_BUILD_AOT=1",
"-DWAMR_BUILD_FAST_INTERP=0",
"-DWAMR_BUILD_INTERP=0",
Expand All @@ -42,7 +42,7 @@ cmake(
}),
out_static_libs = ["libvmlib.a"],
deps = select({
"@proxy_wasm_cpp_host//bazel:engine_wamr_jit": ["@llvm-13_0_1//:llvm_13_0_1_lib"],
"@proxy_wasm_cpp_host//bazel:engine_wamr_jit": ["@llvm-15_0_7//:llvm_wamr_lib"],
"//conditions:default": [],
}),
)
9 changes: 3 additions & 6 deletions bazel/external/wamr_llvm.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ filegroup(
)

cmake(
name = "llvm_13_0_1_lib",
name = "llvm_wamr_lib",
cache_entries = {
# Disable both: BUILD and INCLUDE, since some of the INCLUDE
# targets build code instead of only generating build files.
Expand All @@ -20,20 +20,16 @@ cmake(
"LLVM_INCLUDE_DOCS": "off",
"LLVM_BUILD_EXAMPLES": "off",
"LLVM_INCLUDE_EXAMPLES": "off",
"LLVM_BUILD_RUNTIME": "off",
"LLVM_BUILD_RUNTIMES": "off",
"LLVM_INCLUDE_RUNTIMES": "off",
"LLVM_BUILD_TESTS": "off",
"LLVM_INCLUDE_TESTS": "off",
"LLVM_BUILD_TOOLS": "off",
"LLVM_INCLUDE_TOOLS": "off",
"LLVM_BUILD_UTILS": "off",
"LLVM_INCLUDE_UTILS": "off",
"LLVM_ENABLE_IDE": "off",
"LLVM_ENABLE_LIBEDIT": "off",
"LLVM_ENABLE_LIBXML2": "off",
"LLVM_ENABLE_TERMINFO": "off",
"LLVM_ENABLE_ZLIB": "off",
"LLVM_ENABLE_ZSTD": "off",
"LLVM_TARGETS_TO_BUILD": "X86",
"CMAKE_CXX_FLAGS": "-Wno-unused-command-line-argument",
},
Expand Down Expand Up @@ -133,4 +129,5 @@ cmake(
"libLLVMSupport.a",
"libLLVMDemangle.a",
],
working_directory = "llvm",
)
16 changes: 8 additions & 8 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ def proxy_wasm_cpp_host_repositories():
http_archive,
name = "com_github_bytecodealliance_wasm_micro_runtime",
build_file = "@proxy_wasm_cpp_host//bazel/external:wamr.BUILD",
# WAMR-2022-12-16
sha256 = "976b928f420040a77e793051e4d742208adf157370b9ad0f5535e126adb31eb0",
strip_prefix = "wasm-micro-runtime-WAMR-1.1.2",
url = "https://github.com/bytecodealliance/wasm-micro-runtime/archive/WAMR-1.1.2.tar.gz",
# WAMR-1.2.1
sha256 = "7548d4bbea8dbb9b005e83bd571f93a12fb3f0b5e87a8b0130f004dd92df4b0b",
strip_prefix = "wasm-micro-runtime-WAMR-1.2.1",
url = "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-1.2.1.zip",
)

native.bind(
Expand All @@ -172,11 +172,11 @@ def proxy_wasm_cpp_host_repositories():

maybe(
http_archive,
name = "llvm-13_0_1",
name = "llvm-15_0_7",
build_file = "@proxy_wasm_cpp_host//bazel/external:wamr_llvm.BUILD",
sha256 = "ec6b80d82c384acad2dc192903a6cf2cdbaffb889b84bfb98da9d71e630fc834",
strip_prefix = "llvm-13.0.1.src",
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/llvm-13.0.1.src.tar.xz",
sha256 = "8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6",
strip_prefix = "llvm-project-15.0.7.src",
url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/llvm-project-15.0.7.src.tar.xz",
)

# WasmEdge with dependencies.
Expand Down
15 changes: 10 additions & 5 deletions src/wamr/wamr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,15 @@ bool Wamr::link(std::string_view /*debug_name*/) {
const wasm_name_t *name_ptr = wasm_importtype_name(import_types.get()->data[i]);
const wasm_externtype_t *extern_type = wasm_importtype_type(import_types.get()->data[i]);

std::string_view module_name(module_name_ptr->data, module_name_ptr->size);
std::string_view name(name_ptr->data, name_ptr->size);
assert(name_ptr->size > 0);
if (std::strlen(name_ptr->data) == 0) {
fail(FailState::UnableToInitializeCode, std::string("The name field of import_types[") +
std::to_string(i) + std::string("] is empty"));
return false;
}

std::string_view module_name(module_name_ptr->data);
std::string_view name(name_ptr->data);

switch (wasm_externtype_kind(extern_type)) {
case WASM_EXTERN_FUNC: {
auto it = host_functions_.find(std::string(module_name) + "." + std::string(name));
Expand Down Expand Up @@ -354,8 +360,7 @@ bool Wamr::link(std::string_view /*debug_name*/) {
case WASM_EXTERN_FUNC: {
WasmFuncPtr func = wasm_func_copy(wasm_extern_as_func(actual_extern));
const wasm_name_t *name_ptr = wasm_exporttype_name(export_types.get()->data[i]);
module_functions_.insert_or_assign(std::string(name_ptr->data, name_ptr->size),
std::move(func));
module_functions_.insert_or_assign(std::string(name_ptr->data), std::move(func));
} break;
case WASM_EXTERN_GLOBAL: {
// TODO(mathetake): add support when/if needed.
Expand Down