Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
aa05360
build(deps): Bump github/codeql-action from 3.28.8 to 3.28.9 (#4074)
dependabot[bot] Feb 11, 2025
1465c3c
Unit test:type matching issue and code redundancy (#4079)
yangkun27 Feb 14, 2025
71bc3c2
Add a conditional check for the macro __STDC_VERSION__ (#4080)
yangkun27 Feb 14, 2025
46904dc
build_llvm.py: Allow to build xtensa target on non-xtensa host
no1wudi Feb 14, 2025
1971cac
Merge pull request #4086 from no1wudi/fix
no1wudi Feb 15, 2025
d86bd7c
fix(build_llvm.py): clean up whitespace and formatting in build script
no1wudi Feb 15, 2025
159f589
[gc] Subtyping fix (#4075)
vouillon Feb 17, 2025
48b75e0
Merge pull request #4087 from no1wudi/fix
no1wudi Feb 17, 2025
964037c
feat: add support for EXTERNREF value type and enable AOT validator i…
lum1n0us Feb 17, 2025
45db4ba
fix(unit-test): libc_builtin_test issues (#4073)
peter-tatrai Feb 17, 2025
ff10b86
fix(build_llvm_libraries.yml): Correct script path for build_llvm.py
no1wudi Feb 17, 2025
d0e2a72
fix(aot_emit_aot_file): prevent buffer emission for zero byte_count (…
lum1n0us Feb 20, 2025
f2ef9ee
Cmake improvements (#4076)
peter-tatrai Feb 21, 2025
d9c01b3
fix: when load aot init expr,no type_idx set. (#4094)
chenliuyang1989 Feb 21, 2025
dfcadc6
prevent data overflow on 32 bit platform for memory.grow
TianlongLiang Feb 8, 2025
2e4ebfb
cr suggestions
TianlongLiang Feb 12, 2025
f1ffbb5
cr suggestions
TianlongLiang Feb 12, 2025
e72338b
format
TianlongLiang Feb 12, 2025
851a26d
cr suggestions
TianlongLiang Feb 18, 2025
1252f72
feat: use C linkage in aot_comp_option.h for C++ embeding (#4106)
Jiax-cn Feb 24, 2025
8288190
build(deps): Bump actions/upload-artifact from 4.6.0 to 4.6.1
dependabot[bot] Feb 24, 2025
e158f66
build(deps): Bump github/codeql-action from 3.28.9 to 3.28.10
dependabot[bot] Feb 24, 2025
8b4ef08
Apply suggestions from code review
lum1n0us Feb 24, 2025
3f268e5
build(deps): Bump ossf/scorecard-action from 2.4.0 to 2.4.1
dependabot[bot] Feb 24, 2025
968b7d4
fix: add dispose of the debug information builder when destroying com…
Jiax-cn Feb 26, 2025
f2e3348
wasm_loader allocates more spaces for elements (#4099)
lum1n0us Feb 26, 2025
e693608
log warning instaed of assertion (#4119)
TianlongLiang Mar 1, 2025
73998e4
fix: fix load aarch64 aot failed (#4114)
Jiax-cn Mar 4, 2025
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
1 change: 1 addition & 0 deletions .github/workflows/build_llvm_libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
shell: bash
run: |
echo "last_commit=$(GH_TOKEN=${{ secrets.GITHUB_TOKEN }} /usr/bin/env python3 ./build_llvm.py ${{ inputs.extra_build_llvm_options }} --llvm-ver)" >> $GITHUB_OUTPUT
working-directory: build-scripts

# Bump the prefix number to evict all previous caches and
# enforce a clean build, in the unlikely case that some
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3.28.8
uses: github/codeql-action/init@v3.28.10
with:
languages: ${{ matrix.language }}

Expand All @@ -70,7 +70,7 @@ jobs:
- run: |
./.github/scripts/codeql_buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3.28.8
uses: github/codeql-action/analyze@v3.28.10
with:
category: "/language:${{matrix.language}}"
upload: false
Expand Down Expand Up @@ -99,14 +99,14 @@ jobs:
output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif

- name: Upload CodeQL results to code scanning
uses: github/codeql-action/upload-sarif@v3.28.8
uses: github/codeql-action/upload-sarif@v3.28.10
with:
sarif_file: ${{ steps.step1.outputs.sarif-output }}
category: "/language:${{matrix.language}}"

- name: Upload CodeQL results as an artifact
if: success() || failure()
uses: actions/upload-artifact@v4.6.0
uses: actions/upload-artifact@v4.6.1
with:
name: codeql-results
path: ${{ steps.step1.outputs.sarif-output }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spec_test_on_nuttx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ jobs:

- name: upload the log
if: always()
uses: actions/upload-artifact@v4.6.0
uses: actions/upload-artifact@v4.6.1
with:
name: spec-test-log-${{ github.run_id }}-${{ strategy.job-index }}-${{ matrix.target_config.target }}
path: log
6 changes: 3 additions & 3 deletions .github/workflows/supply_chain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
with:
results_file: results.sarif
results_format: sarif
Expand All @@ -52,14 +52,14 @@ jobs:
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v3.1.0
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v3.1.0
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@0701025a8b1600e416be4f3bb5a830b1aa6af01e # v2.2.4
uses: github/codeql-action/upload-sarif@ff79de67cc25c7617163ae1e4b8aa23b902fdf15
with:
sarif_file: results.sarif
98 changes: 39 additions & 59 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

cmake_minimum_required (VERSION 3.0)

option(BUILD_SHARED_LIBS "Build using shared libraries" OFF)

if(ESP_PLATFORM)
include (${COMPONENT_DIR}/build-scripts/esp-idf/wamr/CMakeLists.txt)
return()
Expand All @@ -18,13 +20,6 @@ if (NOT DEFINED WAMR_BUILD_PLATFORM)
string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
endif ()

if (NOT DEFINED WAMR_BUILD_STATIC)
set (WAMR_BUILD_STATIC 1)
endif ()
if (NOT DEFINED WAMR_BUILD_SHARED)
set (WAMR_BUILD_SHARED 1)
endif ()

# Reset default linker flags
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
Expand Down Expand Up @@ -156,55 +151,40 @@ if (MSVC)
add_definitions(-DCOMPILING_WASM_RUNTIME_API=1)
endif ()

# STATIC LIBRARY
if (WAMR_BUILD_STATIC)
add_library(iwasm_static STATIC ${WAMR_RUNTIME_LIB_SOURCE})
set_target_properties (iwasm_static PROPERTIES OUTPUT_NAME vmlib)
target_include_directories(iwasm_static INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include)
target_link_libraries (iwasm_static INTERFACE ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT})
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
target_link_libraries(iwasm_static INTERFACE boringssl_crypto)
endif ()

if (MINGW)
target_link_libraries (iwasm_static PRIVATE ws2_32)
endif ()

if (WIN32)
target_link_libraries(iwasm_static PRIVATE ntdll)
endif()

set_version_info (iwasm_static)
install (TARGETS iwasm_static ARCHIVE DESTINATION lib)
endif ()

# SHARED LIBRARY
if (WAMR_BUILD_SHARED)
add_library (iwasm_shared SHARED ${WAMR_RUNTIME_LIB_SOURCE})
set_target_properties (iwasm_shared PROPERTIES OUTPUT_NAME iwasm)
target_include_directories(iwasm_shared INTERFACE ${WAMR_ROOT_DIR}/core/iwasm/include)
target_link_libraries (iwasm_shared PUBLIC ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT})
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
target_link_libraries(iwasm_shared INTERFACE boringssl_crypto)
endif ()

if (MINGW)
target_link_libraries(iwasm_shared INTERFACE -lWs2_32 -lwsock32)
target_link_libraries(iwasm_shared PRIVATE ws2_32)
endif ()

if (WIN32)
target_link_libraries(iwasm_shared PRIVATE ntdll)
endif()

set_version_info (iwasm_shared)
install (TARGETS iwasm_shared LIBRARY DESTINATION lib)
endif ()

# HEADERS
install (FILES
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h
${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h
${WAMR_ROOT_DIR}/core/version.h
DESTINATION include)
add_library (vmlib ${WAMR_RUNTIME_LIB_SOURCE})
set_target_properties (vmlib PROPERTIES OUTPUT_NAME iwasm)
target_include_directories(vmlib INTERFACE
$<BUILD_INTERFACE:${WAMR_ROOT_DIR}/core/iwasm/include>
$<INSTALL_INTERFACE:include/iwasm>
)

target_link_libraries (vmlib PUBLIC ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl ${CMAKE_THREAD_LIBS_INIT})
if (WAMR_BUILD_WASM_CACHE EQUAL 1)
target_link_libraries(vmlib INTERFACE boringssl_crypto)
endif ()

if (MINGW)
target_link_libraries(vmlib INTERFACE -lWs2_32 -lwsock32)
target_link_libraries(vmlib PRIVATE ws2_32)
endif ()

if (WIN32)
target_link_libraries(vmlib PRIVATE ntdll)
endif()

set (WAMR_PUBLIC_HEADERS
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_c_api.h
${WAMR_ROOT_DIR}/core/iwasm/include/wasm_export.h
${WAMR_ROOT_DIR}/core/iwasm/include/lib_export.h
)
set_target_properties (vmlib PROPERTIES PUBLIC_HEADER "${WAMR_PUBLIC_HEADERS}")

set_version_info (vmlib)

install (TARGETS vmlib
EXPORT iwasmTargets
LIBRARY DESTINATION lib
PUBLIC_HEADER DESTINATION include/iwasm
)

install_iwasm_package ()
14 changes: 4 additions & 10 deletions build-scripts/build_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,11 @@ def build_llvm(llvm_dir, platform, backends, projects, use_clang=False, extra_fl
]

# if not on ARC platform, but want to add expeirmental backend ARC as target
if platform != "ARC" and "ARC" in backends:
if platform != "ARC" and "ARC" in backends:
LLVM_TARGETS_TO_BUILD.extend(
LLVM_EXTRA_COMPILE_OPTIONS["arc"]
)

if platform != "Xtensa" and "Xtensa" in backends:
print(
"Currently it's not supported to build Xtensa backend on non-Xtensa platform"
)
return None

LLVM_PROJECTS_TO_BUILD = [
'-DLLVM_ENABLE_PROJECTS:STRING="' + ";".join(projects) + '"' if projects else ""
]
Expand Down Expand Up @@ -217,11 +211,11 @@ def repackage_llvm_windows(llvm_dir):
if not packs_path:
raise Exception("Didn't find any LLVM-* package")
return

llvm_package_path = f"_CPack_Packages/win64/NSIS/{packs_path[0].name}"
windows_package_dir = build_dir.joinpath(llvm_package_path).resolve()

# mv package dir outside of build
# mv package dir outside of build
shutil.move(str(windows_package_dir), str(llvm_dir))
# rm -r build
shutil.rmtree(str(build_dir))
Expand All @@ -231,7 +225,7 @@ def repackage_llvm_windows(llvm_dir):
moved_package_dir = llvm_dir.joinpath(packs_path[0].name)
for sub_dir in moved_package_dir.iterdir():
shutil.move(str(sub_dir), str(build_dir))
moved_package_dir.rmdir()
moved_package_dir.rmdir()

def main():
parser = argparse.ArgumentParser(description="build necessary LLVM libraries")
Expand Down
5 changes: 5 additions & 0 deletions build-scripts/config_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ endif ()
# Version
include (${WAMR_ROOT_DIR}/build-scripts/version.cmake)

# Package
include (${WAMR_ROOT_DIR}/build-scripts/package.cmake)

# Sanitizers

if (NOT DEFINED WAMR_BUILD_SANITIZER)
Expand Down Expand Up @@ -211,7 +214,9 @@ endif ()

message ("-- Build Configurations:")
message (" Build as target ${WAMR_BUILD_TARGET}")
message (" Build for platform ${WAMR_BUILD_PLATFORM}")
message (" CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE})
message (" BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS})
################## running mode ##################
if (WAMR_BUILD_INTERP EQUAL 1)
message (" WAMR Interpreter enabled")
Expand Down
6 changes: 6 additions & 0 deletions build-scripts/iwasmConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

@PACKAGE_INIT@

include("${CMAKE_CURRENT_LIST_DIR}/iwasmTargets.cmake")
28 changes: 28 additions & 0 deletions build-scripts/package.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright (C) 2019 Intel Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

function(install_iwasm_package)
install (EXPORT iwasmTargets
FILE iwasmTargets.cmake
NAMESPACE iwasm::
DESTINATION lib/cmake/iwasm
)

include (CMakePackageConfigHelpers)
configure_package_config_file (${CMAKE_CURRENT_FUNCTION_LIST_DIR}/iwasmConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfig.cmake"
INSTALL_DESTINATION lib/cmake/iwasm
)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfigVersion.cmake"
VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}
COMPATIBILITY SameMajorVersion
)

install (FILES
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/iwasmConfigVersion.cmake"
DESTINATION lib/cmake/iwasm
)
endfunction()
11 changes: 8 additions & 3 deletions core/iwasm/aot/aot_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,12 @@ loader_mmap(uint32 size, bool prot_exec, char *error_buf, uint32 error_buf_size)
map_flags = MMAP_MAP_32BIT;
if ((mem = os_mmap(NULL, size, map_prot, map_flags,
os_get_invalid_handle()))) {
/* The mmapped memory must be in the first 2 Gigabytes of the
/* Test whether the mmapped memory in the first 2 Gigabytes of the
process address space */
bh_assert((uintptr_t)mem < INT32_MAX);
if ((uintptr_t)mem >= INT32_MAX)
LOG_WARNING(
"Warning: loader mmap memory address is not in the first 2 "
"Gigabytes of the process address space.");
return mem;
}
#endif
Expand Down Expand Up @@ -587,7 +590,8 @@ load_target_info_section(const uint8 *buf, const uint8 *buf_end,
}

/* for backwards compatibility with previous wamrc aot files */
if (!strcmp(target_info.arch, "arm64"))
if (!strcmp(target_info.arch, "arm64")
|| !strcmp(target_info.arch, "aarch64"))
bh_strcpy_s(target_info.arch, sizeof(target_info.arch), "aarch64v8");

/* Check machine info */
Expand Down Expand Up @@ -1251,6 +1255,7 @@ load_init_expr(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
}
free_if_fail = true;
init_values->count = field_count;
init_values->type_idx = type_idx;
expr->u.data = init_values;

if (type_idx >= module->type_count) {
Expand Down
2 changes: 1 addition & 1 deletion core/iwasm/aot/arch/aot_reloc_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ get_current_target(char *target_buf, uint32 target_buf_size)
/* Set to "aarch64v8" by default if sub version isn't specified */
if (strcmp(s, "AARCH64") == 0) {
s = "aarch64v8";
s_size = 9; /* strlen("aarch64v8"); */
s_size = 10; /* sizeof("aarch64v8"); */
}
if (target_buf_size < s_size) {
s_size = target_buf_size;
Expand Down
22 changes: 13 additions & 9 deletions core/iwasm/common/gc/gc_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,14 @@ wasm_reftype_is_subtype_of(uint8 type1, const WASMRefType *ref_type1,
return true;
else {
int32 heap_type = ref_type1->ref_ht_common.heap_type;
// We dont care whether type2 is nullable or not. So
// we normalize it into its related one-byte type.
if (type2 == REF_TYPE_HT_NULLABLE
|| type2 == REF_TYPE_HT_NON_NULLABLE) {
bh_assert(ref_type2);
type2 = (uint8)(ref_type2->ref_ht_common.heap_type
+ REF_TYPE_FUNCREF - HEAP_TYPE_FUNC);
}
if (heap_type == HEAP_TYPE_ANY) {
/* (ref any) <: anyref */
return type2 == REF_TYPE_ANYREF ? true : false;
Expand Down Expand Up @@ -1188,19 +1196,15 @@ wasm_reftype_is_subtype_of(uint8 type1, const WASMRefType *ref_type1,
}
#endif
else if (heap_type == HEAP_TYPE_NONE) {
/* (ref none) */
/* TODO */
bh_assert(0);
return wasm_is_reftype_supers_of_none(type2, NULL, types,
type_count);
}
else if (heap_type == HEAP_TYPE_NOEXTERN) {
/* (ref noextern) */
/* TODO */
bh_assert(0);
return wasm_is_reftype_supers_of_noextern(type2);
}
else if (heap_type == HEAP_TYPE_NOFUNC) {
/* (ref nofunc) */
/* TODO */
bh_assert(0);
return wasm_is_reftype_supers_of_nofunc(type2, NULL, types,
type_count);
}
else {
bh_assert(0);
Expand Down
8 changes: 8 additions & 0 deletions core/iwasm/common/wasm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,14 @@ wasm_mremap_linear_memory(void *mapped_mem, uint64 old_size, uint64 new_size,
bh_assert(new_size > 0);
bh_assert(new_size > old_size);

#if UINTPTR_MAX == UINT32_MAX
if (new_size == 4 * (uint64)BH_GB) {
LOG_WARNING("On 32 bit platform, linear memory can't reach maximum "
"size of 4GB\n");
return NULL;
}
#endif

if (mapped_mem) {
new_mem = os_mremap(mapped_mem, old_size, new_size);
}
Expand Down
3 changes: 2 additions & 1 deletion core/iwasm/common/wasm_runtime_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -4458,8 +4458,9 @@ wasm_func_type_get_param_valkind(WASMFuncType *const func_type,
return WASM_V128;
case VALUE_TYPE_FUNCREF:
return WASM_FUNCREF;

case VALUE_TYPE_EXTERNREF:
return WASM_EXTERNREF;

case VALUE_TYPE_VOID:
default:
{
Expand Down
Loading
Loading