Skip to content

Commit 94497de

Browse files
authored
wamr: update to v1.2.1 (with LLVM v15.0.7). (#339)
Signed-off-by: [email protected] <[email protected]>
1 parent 3af2c1a commit 94497de

File tree

4 files changed

+23
-21
lines changed

4 files changed

+23
-21
lines changed

bazel/external/wamr.BUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cmake(
2020
"-GNinja",
2121
] + select({
2222
"@proxy_wasm_cpp_host//bazel:engine_wamr_jit": [
23-
"-DLLVM_DIR=$EXT_BUILD_DEPS/copy_llvm_13_0_1/llvm/lib/cmake/llvm",
23+
"-DLLVM_DIR=$EXT_BUILD_DEPS/copy_llvm-15_0_7/llvm/lib/cmake/llvm",
2424
"-DWAMR_BUILD_AOT=1",
2525
"-DWAMR_BUILD_FAST_INTERP=0",
2626
"-DWAMR_BUILD_INTERP=0",
@@ -42,7 +42,7 @@ cmake(
4242
}),
4343
out_static_libs = ["libvmlib.a"],
4444
deps = select({
45-
"@proxy_wasm_cpp_host//bazel:engine_wamr_jit": ["@llvm-13_0_1//:llvm_13_0_1_lib"],
45+
"@proxy_wasm_cpp_host//bazel:engine_wamr_jit": ["@llvm-15_0_7//:llvm_wamr_lib"],
4646
"//conditions:default": [],
4747
}),
4848
)

bazel/external/wamr_llvm.BUILD

+3-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ filegroup(
1010
)
1111

1212
cmake(
13-
name = "llvm_13_0_1_lib",
13+
name = "llvm_wamr_lib",
1414
cache_entries = {
1515
# Disable both: BUILD and INCLUDE, since some of the INCLUDE
1616
# targets build code instead of only generating build files.
@@ -20,20 +20,16 @@ cmake(
2020
"LLVM_INCLUDE_DOCS": "off",
2121
"LLVM_BUILD_EXAMPLES": "off",
2222
"LLVM_INCLUDE_EXAMPLES": "off",
23-
"LLVM_BUILD_RUNTIME": "off",
24-
"LLVM_BUILD_RUNTIMES": "off",
25-
"LLVM_INCLUDE_RUNTIMES": "off",
2623
"LLVM_BUILD_TESTS": "off",
2724
"LLVM_INCLUDE_TESTS": "off",
2825
"LLVM_BUILD_TOOLS": "off",
2926
"LLVM_INCLUDE_TOOLS": "off",
30-
"LLVM_BUILD_UTILS": "off",
31-
"LLVM_INCLUDE_UTILS": "off",
3227
"LLVM_ENABLE_IDE": "off",
3328
"LLVM_ENABLE_LIBEDIT": "off",
3429
"LLVM_ENABLE_LIBXML2": "off",
3530
"LLVM_ENABLE_TERMINFO": "off",
3631
"LLVM_ENABLE_ZLIB": "off",
32+
"LLVM_ENABLE_ZSTD": "off",
3733
"LLVM_TARGETS_TO_BUILD": "X86",
3834
"CMAKE_CXX_FLAGS": "-Wno-unused-command-line-argument",
3935
},
@@ -133,4 +129,5 @@ cmake(
133129
"libLLVMSupport.a",
134130
"libLLVMDemangle.a",
135131
],
132+
working_directory = "llvm",
136133
)

bazel/repositories.bzl

+8-8
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ def proxy_wasm_cpp_host_repositories():
159159
http_archive,
160160
name = "com_github_bytecodealliance_wasm_micro_runtime",
161161
build_file = "@proxy_wasm_cpp_host//bazel/external:wamr.BUILD",
162-
# WAMR-2022-12-16
163-
sha256 = "976b928f420040a77e793051e4d742208adf157370b9ad0f5535e126adb31eb0",
164-
strip_prefix = "wasm-micro-runtime-WAMR-1.1.2",
165-
url = "https://github.com/bytecodealliance/wasm-micro-runtime/archive/WAMR-1.1.2.tar.gz",
162+
# WAMR-1.2.1
163+
sha256 = "7548d4bbea8dbb9b005e83bd571f93a12fb3f0b5e87a8b0130f004dd92df4b0b",
164+
strip_prefix = "wasm-micro-runtime-WAMR-1.2.1",
165+
url = "https://github.com/bytecodealliance/wasm-micro-runtime/archive/refs/tags/WAMR-1.2.1.zip",
166166
)
167167

168168
native.bind(
@@ -172,11 +172,11 @@ def proxy_wasm_cpp_host_repositories():
172172

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

182182
# WasmEdge with dependencies.

src/wamr/wamr.cc

+10-5
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,15 @@ bool Wamr::link(std::string_view /*debug_name*/) {
261261
const wasm_name_t *name_ptr = wasm_importtype_name(import_types.get()->data[i]);
262262
const wasm_externtype_t *extern_type = wasm_importtype_type(import_types.get()->data[i]);
263263

264-
std::string_view module_name(module_name_ptr->data, module_name_ptr->size);
265-
std::string_view name(name_ptr->data, name_ptr->size);
266-
assert(name_ptr->size > 0);
264+
if (std::strlen(name_ptr->data) == 0) {
265+
fail(FailState::UnableToInitializeCode, std::string("The name field of import_types[") +
266+
std::to_string(i) + std::string("] is empty"));
267+
return false;
268+
}
269+
270+
std::string_view module_name(module_name_ptr->data);
271+
std::string_view name(name_ptr->data);
272+
267273
switch (wasm_externtype_kind(extern_type)) {
268274
case WASM_EXTERN_FUNC: {
269275
auto it = host_functions_.find(std::string(module_name) + "." + std::string(name));
@@ -354,8 +360,7 @@ bool Wamr::link(std::string_view /*debug_name*/) {
354360
case WASM_EXTERN_FUNC: {
355361
WasmFuncPtr func = wasm_func_copy(wasm_extern_as_func(actual_extern));
356362
const wasm_name_t *name_ptr = wasm_exporttype_name(export_types.get()->data[i]);
357-
module_functions_.insert_or_assign(std::string(name_ptr->data, name_ptr->size),
358-
std::move(func));
363+
module_functions_.insert_or_assign(std::string(name_ptr->data), std::move(func));
359364
} break;
360365
case WASM_EXTERN_GLOBAL: {
361366
// TODO(mathetake): add support when/if needed.

0 commit comments

Comments
 (0)