diff --git a/.github/workflows/check_version_h.yml b/.github/workflows/check_version_h.yml new file mode 100644 index 000000000..ab23ecf9e --- /dev/null +++ b/.github/workflows/check_version_h.yml @@ -0,0 +1,29 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +name: confirm version.h stay in sync + +on: + workflow_call: + +permissions: + contents: read + +jobs: + confirm_version: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: cmake execute to generate version.h + run: cmake -B build_version -S . + + - name: confirm version.h + run: | + if [ -z "$(git status --porcelain | grep version.h)" ]; then + echo "version.h is in sync" + else + echo "version.h is not in sync" + exit 1 + fi diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 753322fcc..a98d5f1a9 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -53,7 +53,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3.28.1 + uses: github/codeql-action/init@v3.28.8 with: languages: ${{ matrix.language }} @@ -70,7 +70,7 @@ jobs: - run: | ./.github/scripts/codeql_buildscript.sh - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3.28.1 + uses: github/codeql-action/analyze@v3.28.8 with: category: "/language:${{matrix.language}}" upload: false @@ -99,7 +99,7 @@ jobs: output: ${{ steps.step1.outputs.sarif-output }}/cpp.sarif - name: Upload CodeQL results to code scanning - uses: github/codeql-action/upload-sarif@v3.28.1 + uses: github/codeql-action/upload-sarif@v3.28.8 with: sarif_file: ${{ steps.step1.outputs.sarif-output }} category: "/language:${{matrix.language}}" diff --git a/.github/workflows/compilation_on_android_ubuntu.yml b/.github/workflows/compilation_on_android_ubuntu.yml index 119c8b2d0..057082ebc 100644 --- a/.github/workflows/compilation_on_android_ubuntu.yml +++ b/.github/workflows/compilation_on_android_ubuntu.yml @@ -74,6 +74,12 @@ permissions: contents: read jobs: + check_version_h: + permissions: + contents: read + actions: write + uses: ./.github/workflows/check_version_h.yml + build_llvm_libraries_on_ubuntu_2204: permissions: contents: read @@ -675,7 +681,7 @@ jobs: test_option: $MEMORY64_TEST_OPTIONS - running_mode: "multi-tier-jit" test_option: $MEMORY64_TEST_OPTIONS - # aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory + # aot, fast-interp, fast-jit, llvm-jit, multi-tier-jit don't support Multi Memory - running_mode: "aot" test_option: $MULTI_MEMORY_TEST_OPTIONS - running_mode: "fast-interp" @@ -817,7 +823,7 @@ jobs: - name: install dependencies run: | - rustup target add wasm32-wasi + rustup target add wasm32-wasip1 sudo apt update && sudo apt-get install -y lld ninja-build npm install working-directory: test-tools/wamr-ide/VSCode-Extension diff --git a/.github/workflows/supply_chain.yml b/.github/workflows/supply_chain.yml index 39f2f9835..4c743d2ec 100644 --- a/.github/workflows/supply_chain.yml +++ b/.github/workflows/supply_chain.yml @@ -60,6 +60,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@db7177a1c66bea89f5e7ce32d0ea48bea4a0d460 # v2.2.4 + uses: github/codeql-action/upload-sarif@0701025a8b1600e416be4f3bb5a830b1aa6af01e # v2.2.4 with: sarif_file: results.sarif diff --git a/CMakeLists.txt b/CMakeLists.txt index a637c3643..6362d0e56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,7 @@ if (WAMR_BUILD_STATIC) target_link_libraries(iwasm_static PRIVATE ntdll) endif() + set_version_info (iwasm_static) install (TARGETS iwasm_static ARCHIVE DESTINATION lib) endif () @@ -196,6 +197,7 @@ if (WAMR_BUILD_SHARED) target_link_libraries(iwasm_shared PRIVATE ntdll) endif() + set_version_info (iwasm_shared) install (TARGETS iwasm_shared LIBRARY DESTINATION lib) endif () @@ -204,4 +206,5 @@ 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) diff --git a/build-scripts/config_common.cmake b/build-scripts/config_common.cmake index 6a30bfb7b..88abf7324 100644 --- a/build-scripts/config_common.cmake +++ b/build-scripts/config_common.cmake @@ -131,6 +131,9 @@ else () unset (LLVM_AVAILABLE_LIBS) endif () +# Version +include (${WAMR_ROOT_DIR}/build-scripts/version.cmake) + # Sanitizers if (NOT DEFINED WAMR_BUILD_SANITIZER) @@ -167,16 +170,61 @@ if (NOT DEFINED WAMR_BUILD_SHRUNK_MEMORY) set (WAMR_BUILD_SHRUNK_MEMORY 1) endif () +######################################## +# Default values +######################################## +if (NOT DEFINED WAMR_BUILD_BULK_MEMORY) + set (WAMR_BUILD_BULK_MEMORY 1) +endif () + +if (NOT DEFINED WAMR_BUILD_EXCE_HANDLING) + set (WAMR_BUILD_EXCE_HANDLING 0) +endif () + +if (NOT DEFINED WAMR_BUILD_GC) + set (WAMR_BUILD_GC 0) +endif () + +if (NOT DEFINED WAMR_BUILD_MEMORY64) + set (WAMR_BUILD_MEMORY64 0) +endif () + +if (NOT DEFINED WAMR_BUILD_MULTI_MEMORY) + set (WAMR_BUILD_MULTI_MEMORY 0) +endif () + +if (NOT DEFINED WAMR_BUILD_SHARED_MEMORY) + set(WAMR_BUILD_SHARED_MEMORY 0) +endif () + +if (NOT DEFINED WAMR_BUILD_STRINGREF) + set(WAMR_BUILD_STRINGREF 0) +endif () + +if (NOT DEFINED WAMR_BUILD_TAIL_CALL) + set (WAMR_BUILD_TAIL_CALL 0) +endif () + +######################################## +# Compilation options to marco ######################################## message ("-- Build Configurations:") message (" Build as target ${WAMR_BUILD_TARGET}") message (" CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE}) +################## running mode ################## if (WAMR_BUILD_INTERP EQUAL 1) message (" WAMR Interpreter enabled") else () message (" WAMR Interpreter disabled") endif () +if ((WAMR_BUILD_FAST_INTERP EQUAL 1) AND (WAMR_BUILD_INTERP EQUAL 1)) + add_definitions (-DWASM_ENABLE_FAST_INTERP=1) + message (" Fast interpreter enabled") +else () + add_definitions (-DWASM_ENABLE_FAST_INTERP=0) + message (" Fast interpreter disabled") +endif () if (WAMR_BUILD_AOT EQUAL 1) message (" WAMR AOT enabled") else () @@ -207,6 +255,16 @@ if (WAMR_BUILD_FAST_JIT EQUAL 1 AND WAMR_BUILD_JIT EQUAL 1 AND WAMR_BUILD_LAZY_JIT EQUAL 1) message (" Multi-tier JIT enabled") endif () +################## test modes ################## +if (WAMR_BUILD_SPEC_TEST EQUAL 1) + add_definitions (-DWASM_ENABLE_SPEC_TEST=1) + message (" spec test compatible mode is on") +endif () +if (WAMR_BUILD_WASI_TEST EQUAL 1) + add_definitions (-DWASM_ENABLE_WASI_TEST=1) + message (" wasi test compatible mode is on") +endif () +################## native ################## if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1) message (" Libc builtin enabled") else () @@ -219,64 +277,6 @@ elseif (WAMR_BUILD_LIBC_WASI EQUAL 1) else () message (" Libc WASI disabled") endif () -if ((WAMR_BUILD_FAST_INTERP EQUAL 1) AND (WAMR_BUILD_INTERP EQUAL 1)) - add_definitions (-DWASM_ENABLE_FAST_INTERP=1) - message (" Fast interpreter enabled") -else () - add_definitions (-DWASM_ENABLE_FAST_INTERP=0) - message (" Fast interpreter disabled") -endif () -if (WAMR_BUILD_MULTI_MODULE EQUAL 1) - add_definitions (-DWASM_ENABLE_MULTI_MODULE=1) - message (" Multiple modules enabled") -else () - add_definitions (-DWASM_ENABLE_MULTI_MODULE=0) - message (" Multiple modules disabled") -endif () -if (WAMR_BUILD_SPEC_TEST EQUAL 1) - add_definitions (-DWASM_ENABLE_SPEC_TEST=1) - message (" spec test compatible mode is on") -endif () -if (WAMR_BUILD_WASI_TEST EQUAL 1) - add_definitions (-DWASM_ENABLE_WASI_TEST=1) - message (" wasi test compatible mode is on") -endif () -if (NOT DEFINED WAMR_BUILD_BULK_MEMORY) - # Enable bulk memory by default - set (WAMR_BUILD_BULK_MEMORY 1) -endif () -if (WAMR_BUILD_BULK_MEMORY EQUAL 1) - add_definitions (-DWASM_ENABLE_BULK_MEMORY=1) - message (" Bulk memory feature enabled") -else () - add_definitions (-DWASM_ENABLE_BULK_MEMORY=0) - message (" Bulk memory feature disabled") -endif () -if (WAMR_BUILD_SHARED_MEMORY EQUAL 1) - add_definitions (-DWASM_ENABLE_SHARED_MEMORY=1) - message (" Shared memory enabled") -else () - add_definitions (-DWASM_ENABLE_SHARED_MEMORY=0) -endif () -if (WAMR_BUILD_SHARED_HEAP EQUAL 1) - add_definitions (-DWASM_ENABLE_SHARED_HEAP=1) - message (" Shared heap enabled") -endif() - -if (WAMR_BUILD_MEMORY64 EQUAL 1) - # if native is 32-bit or cross-compiled to 32-bit - if (NOT WAMR_BUILD_TARGET MATCHES ".*64.*") - message (FATAL_ERROR "-- Memory64 is only available on the 64-bit platform/target") - endif() - add_definitions (-DWASM_ENABLE_MEMORY64=1) - set (WAMR_DISABLE_HW_BOUND_CHECK 1) - message (" Memory64 memory enabled") -endif () -if (WAMR_BUILD_MULTI_MEMORY EQUAL 1) - add_definitions (-DWASM_ENABLE_MULTI_MEMORY=1) - message (" Multi memory enabled") - set (WAMR_BUILD_DEBUG_INTERP 0) -endif () if (WAMR_BUILD_THREAD_MGR EQUAL 1) message (" Thread manager enabled") endif () @@ -295,6 +295,42 @@ endif () if (WAMR_BUILD_LIB_RATS EQUAL 1) message (" Lib rats enabled") endif() +################## WAMR features ################## +if (WAMR_BUILD_MULTI_MODULE EQUAL 1) + add_definitions (-DWASM_ENABLE_MULTI_MODULE=1) + message (" Multiple modules enabled") +else () + add_definitions (-DWASM_ENABLE_MULTI_MODULE=0) + message (" Multiple modules disabled") +endif () +if (WAMR_BUILD_BULK_MEMORY EQUAL 1) + add_definitions (-DWASM_ENABLE_BULK_MEMORY=1) +else () + add_definitions (-DWASM_ENABLE_BULK_MEMORY=0) +endif () +if (WAMR_BUILD_SHARED_MEMORY EQUAL 1) + add_definitions (-DWASM_ENABLE_SHARED_MEMORY=1) + message (" Shared memory enabled") +else () + add_definitions (-DWASM_ENABLE_SHARED_MEMORY=0) +endif () +if (WAMR_BUILD_SHARED_HEAP EQUAL 1) + add_definitions (-DWASM_ENABLE_SHARED_HEAP=1) + message (" Shared heap enabled") +endif() + +if (WAMR_BUILD_MEMORY64 EQUAL 1) + # if native is 32-bit or cross-compiled to 32-bit + if (NOT WAMR_BUILD_TARGET MATCHES ".*64.*") + message (FATAL_ERROR "-- Memory64 is only available on the 64-bit platform/target") + endif() + add_definitions (-DWASM_ENABLE_MEMORY64=1) + set (WAMR_DISABLE_HW_BOUND_CHECK 1) +endif () +if (WAMR_BUILD_MULTI_MEMORY EQUAL 1) + add_definitions (-DWASM_ENABLE_MULTI_MEMORY=1) + set (WAMR_BUILD_DEBUG_INTERP 0) +endif () if (WAMR_BUILD_MINI_LOADER EQUAL 1) add_definitions (-DWASM_ENABLE_MINI_LOADER=1) message (" WASM mini loader enabled") @@ -324,7 +360,6 @@ endif () if (WAMR_BUILD_SIMD EQUAL 1) if (NOT WAMR_BUILD_TARGET MATCHES "RISCV64.*") add_definitions (-DWASM_ENABLE_SIMD=1) - message (" SIMD enabled") else () message (" SIMD disabled due to not supported on target RISCV64") endif () @@ -354,16 +389,11 @@ if (WAMR_BUILD_DUMP_CALL_STACK EQUAL 1) endif () if (WAMR_BUILD_TAIL_CALL EQUAL 1) add_definitions (-DWASM_ENABLE_TAIL_CALL=1) - message (" Tail call enabled") endif () if (WAMR_BUILD_REF_TYPES EQUAL 1) add_definitions (-DWASM_ENABLE_REF_TYPES=1) - message (" Reference types enabled") -else () - message (" Reference types disabled") endif () if (WAMR_BUILD_GC EQUAL 1) - message (" GC enabled") if (WAMR_TEST_GC EQUAL 1) message(" GC testing enabled") endif() @@ -375,7 +405,6 @@ else () message (" GC performance profiling disabled") endif () if (WAMR_BUILD_STRINGREF EQUAL 1) - message (" Stringref enabled") if (NOT DEFINED WAMR_STRINGREF_IMPL_SOURCE) message (" Using WAMR builtin implementation for stringref") else () @@ -610,4 +639,41 @@ if (WAMR_BUILD_SHRUNK_MEMORY EQUAL 1) else () add_definitions (-DWASM_ENABLE_SHRUNK_MEMORY=0) message (" Shrunk memory disabled") +endif() +if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1) + message (" AOT validator enabled") + add_definitions (-DWASM_ENABLE_AOT_VALIDATOR=1) endif () + +######################################## +# Show Phase4 Wasm proposals status. +######################################## + +message ( +"-- About Wasm Proposals:\n" +" Always-on:\n" +" \"Extended Constant Expressions\"\n" +" \"Multi-value\"\n" +" \"Non-trapping float-to-int conversions\"\n" +" \"Sign-extension operators\"\n" +" \"WebAssembly C and C++ API\"\n" +" Configurable. 0 is OFF. 1 is ON:\n" +" \"Bulk Memory Operation\" via WAMR_BUILD_BULK_MEMORY: ${WAMR_BUILD_BULK_MEMORY}\n" +" \"Fixed-width SIMD\" via WAMR_BUILD_SIMD: ${WAMR_BUILD_SIMD}\n" +" \"Garbage collection\" via WAMR_BUILD_GC: ${WAMR_BUILD_GC}\n" +" \"Legacy Exception handling\" via WAMR_BUILD_EXCE_HANDLING: ${WAMR_BUILD_EXCE_HANDLING}\n" +" \"Memory64\" via WAMR_BUILD_MEMORY64: ${WAMR_BUILD_MEMORY64}\n" +" \"Multiple memories\" via WAMR_BUILD_MULTI_MEMORY: ${WAMR_BUILD_MULTI_MEMORY}\n" +" \"Reference Types\" via WAMR_BUILD_REF_TYPES: ${WAMR_BUILD_REF_TYPES}\n" +" \"Reference-Typed Strings\" via WAMR_BUILD_STRINGREF: ${WAMR_BUILD_STRINGREF}\n" +" \"Tail call\" via WAMR_BUILD_TAIL_CALL: ${WAMR_BUILD_TAIL_CALL}\n" +" \"Threads\" via WAMR_BUILD_SHARED_MEMORY: ${WAMR_BUILD_SHARED_MEMORY}\n" +" \"Typed Function References\" via WAMR_BUILD_GC: ${WAMR_BUILD_GC}\n" +" Unsupported (>= Phase4):\n" +" \"Branch Hinting\"\n" +" \"Custom Annotation Syntax in the Text Format\"\n" +" \"Exception handling\"\n" +" \"Import/Export of Mutable Globals\"\n" +" \"JS String Builtins\"\n" +" \"Relaxed SIMD\"\n" +) diff --git a/build-scripts/version.cmake b/build-scripts/version.cmake new file mode 100644 index 000000000..04c4e1ccb --- /dev/null +++ b/build-scripts/version.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +if(NOT WAMR_ROOT_DIR) + # if from wamr-compiler + set(WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) +endif() + +set(WAMR_VERSION_MAJOR 2) +set(WAMR_VERSION_MINOR 2) +set(WAMR_VERSION_PATCH 0) + +message("-- WAMR version: ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH}") + +# Configure the version header file +configure_file( + ${WAMR_ROOT_DIR}/core/version.h.in + ${WAMR_ROOT_DIR}/core/version.h +) + +# Set the library version and SOVERSION +function(set_version_info target) + set_target_properties(${target} + PROPERTIES + VERSION ${WAMR_VERSION_MAJOR}.${WAMR_VERSION_MINOR}.${WAMR_VERSION_PATCH} + SOVERSION ${WAMR_VERSION_MAJOR} +) +endfunction() diff --git a/core/config.h b/core/config.h index 27d26f093..fbbbf6771 100644 --- a/core/config.h +++ b/core/config.h @@ -702,4 +702,8 @@ #define WASM_ENABLE_SHRUNK_MEMORY 1 #endif +#ifndef WASM_ENABLE_AOT_VALIDATOR +#define WASM_ENABLE_AOT_VALIDATOR 0 +#endif + #endif /* end of _CONFIG_H_ */ diff --git a/core/iwasm/aot/aot_loader.c b/core/iwasm/aot/aot_loader.c index bde3ee034..97360e73e 100644 --- a/core/iwasm/aot/aot_loader.c +++ b/core/iwasm/aot/aot_loader.c @@ -10,6 +10,9 @@ #include "../common/wasm_native.h" #include "../common/wasm_loader_common.h" #include "../compilation/aot.h" +#if WASM_ENABLE_AOT_VALIDATOR != 0 +#include "aot_validator.h" +#endif #if WASM_ENABLE_DEBUG_AOT != 0 #include "debug/elf_parser.h" @@ -1106,9 +1109,6 @@ load_memory_info(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module, const uint8 *buf = *p_buf; read_uint32(buf, buf_end, module->import_memory_count); - /* We don't support import_memory_count > 0 currently */ - if (module->import_memory_count > 0) - return false; read_uint32(buf, buf_end, module->memory_count); total_size = sizeof(AOTMemory) * (uint64)module->memory_count; @@ -4403,6 +4403,13 @@ aot_load_from_aot_file(const uint8 *buf, uint32 size, const LoadArgs *args, os_thread_jit_write_protect_np(true); /* Make memory executable */ os_icache_flush(module->code, module->code_size); +#if WASM_ENABLE_AOT_VALIDATOR != 0 + if (!aot_module_validate(module, error_buf, error_buf_size)) { + aot_unload(module); + return NULL; + } +#endif /* WASM_ENABLE_AOT_VALIDATOR != 0 */ + LOG_VERBOSE("Load module success.\n"); return module; } diff --git a/core/iwasm/aot/aot_perf_map.c b/core/iwasm/aot/aot_perf_map.c index 22700dcdd..b96bcd1bf 100644 --- a/core/iwasm/aot/aot_perf_map.c +++ b/core/iwasm/aot/aot_perf_map.c @@ -7,7 +7,6 @@ #include "bh_log.h" #include "bh_platform.h" -#if WASM_ENABLE_LINUX_PERF != 0 struct func_info { uint32 idx; void *ptr; @@ -117,4 +116,3 @@ quit: return ret; } -#endif /* WASM_ENABLE_LINUX_PERF != 0 */ \ No newline at end of file diff --git a/core/iwasm/aot/aot_runtime.c b/core/iwasm/aot/aot_runtime.c index 028bfe89f..f5a135be9 100644 --- a/core/iwasm/aot/aot_runtime.c +++ b/core/iwasm/aot/aot_runtime.c @@ -2630,7 +2630,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function, ret = invoke_native_internal(exec_env, func_ptr, func_type, NULL, attachment, argv, argc, argv); - if (aot_copy_exception(module_inst, NULL)) { + if (!ret) { #ifdef AOT_STACK_FRAME_DEBUG if (aot_stack_frame_callback) { aot_stack_frame_callback(exec_env); @@ -2651,7 +2651,7 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function, aot_free_frame(exec_env); #endif - return ret && !aot_copy_exception(module_inst, NULL) ? true : false; + return ret; } } diff --git a/core/iwasm/aot/aot_validator.c b/core/iwasm/aot/aot_validator.c new file mode 100644 index 000000000..58757f767 --- /dev/null +++ b/core/iwasm/aot/aot_validator.c @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2025 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#include "aot_validator.h" + +static void +set_error_buf(char *error_buf, uint32 error_buf_size, const char *string) +{ + if (error_buf != NULL) { + snprintf(error_buf, error_buf_size, + "AOT module load failed: from validator. %s", string); + } +} + +static bool +aot_memory_info_validate(const AOTModule *module, char *error_buf, + uint32 error_buf_size) +{ + if (module->import_memory_count > 0) { + set_error_buf(error_buf, error_buf_size, + "import memory is not supported"); + return false; + } + + if (module->memory_count < 1) { + set_error_buf(error_buf, error_buf_size, + "there should be >=1 memory in one aot module"); + return false; + } + + return true; +} + +bool +aot_module_validate(const AOTModule *module, char *error_buf, + uint32 error_buf_size) +{ + if (!aot_memory_info_validate(module, error_buf, error_buf_size)) { + return false; + } + + return true; +} diff --git a/core/iwasm/aot/aot_validator.h b/core/iwasm/aot/aot_validator.h new file mode 100644 index 000000000..dd8f0ecb5 --- /dev/null +++ b/core/iwasm/aot/aot_validator.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2025 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#ifndef _AOT_VALIDATOR_H_ +#define _AOT_VALIDATOR_H_ + +#include "aot_runtime.h" + +bool +aot_module_validate(const AOTModule *module, char *error_buf, + uint32 error_buf_size); + +#endif /* _AOT_VALIDATOR_H_ */ diff --git a/core/iwasm/aot/iwasm_aot.cmake b/core/iwasm/aot/iwasm_aot.cmake index efff88dd0..c82501fad 100644 --- a/core/iwasm/aot/iwasm_aot.cmake +++ b/core/iwasm/aot/iwasm_aot.cmake @@ -7,7 +7,19 @@ add_definitions (-DWASM_ENABLE_AOT=1) include_directories (${IWASM_AOT_DIR}) -file (GLOB c_source_all ${IWASM_AOT_DIR}/*.c) +list (APPEND c_source_all + ${IWASM_AOT_DIR}/aot_intrinsic.c + ${IWASM_AOT_DIR}/aot_loader.c + ${IWASM_AOT_DIR}/aot_runtime.c +) + +if (WAMR_BUILD_LINUX_PERF EQUAL 1) + list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_perf_map.c) +endif () + +if (WAMR_BUILD_AOT_VALIDATOR EQUAL 1) + list (APPEND c_source_all ${IWASM_AOT_DIR}/aot_validator.c) +endif () if (WAMR_BUILD_TARGET STREQUAL "X86_64" OR WAMR_BUILD_TARGET STREQUAL "AMD_64") set (arch_source ${IWASM_AOT_DIR}/arch/aot_reloc_x86_64.c) diff --git a/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke b/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke index fe3a8c512..fdbe971d2 100644 --- a/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke +++ b/core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke @@ -13,7 +13,7 @@ RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y --no-install-recommends cmake -RUN rustup target add wasm32-wasi +RUN rustup target add wasm32-wasip1 # # Openvino @@ -37,10 +37,10 @@ WORKDIR /workspaces/wasi-nn RUN git clone --depth 1 https://github.com/bytecodealliance/wasi-nn.git . WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/ -RUN cargo build --target=wasm32-wasi +RUN cargo build --target=wasm32-wasip1 WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/build -RUN cp ../target/wasm32-wasi/debug/wasi-nn-example.wasm . \ +RUN cp ../target/wasm32-wasip1/debug/wasi-nn-example.wasm . \ && wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.xml \ && wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.bin # There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory, @@ -67,30 +67,30 @@ RUN git apply ./bump_wasi_nn_to_0_6_0.patch # recompile with wasi-nn 0.6.0 WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-image/ RUN pushd rust \ - && cargo build --target=wasm32-wasi \ + && cargo build --target=wasm32-wasip1 \ && popd \ && ./download_mobilenet.sh . \ && ls -l mobilenet.xml mobilenet.bin WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-raw/ RUN pushd rust \ - && cargo build --target=wasm32-wasi \ + && cargo build --target=wasm32-wasip1 \ && popd \ && ./download_mobilenet.sh . \ && ls -l mobilenet.xml mobilenet.bin tensor-1x224x224x3-f32.bgr WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-road-segmentation-adas/ RUN pushd openvino-road-seg-adas \ - && cargo build --target=wasm32-wasi + && cargo build --target=wasm32-wasip1 WORKDIR /workspaces/wasmedge-wasinn-examples/tflite-birds_v1-image/ RUN pushd rust \ - && cargo build --target=wasm32-wasi + && cargo build --target=wasm32-wasip1 # mount models when running WORKDIR /workspaces/wasmedge-wasinn-examples/wasmedge-ggml/qwen RUN wget --progress=dot:giga https://www.modelscope.cn/models/qwen/Qwen1.5-0.5B-Chat-GGUF/resolve/master/qwen1_5-0_5b-chat-q2_k.gguf -RUN cargo build --target=wasm32-wasi +RUN cargo build --target=wasm32-wasip1 # # iwasm. build from source @@ -107,7 +107,7 @@ RUN OpenVINO_DIR=/usr/lib/openvino-2023.2.0 \ -DWAMR_BUILD_WASI_NN_LLAMACPP=1 \ && cmake --build build \ && cmake --install build - + ENV LD_LIBRARY_PATH=/usr/local/lib # add smoke test script diff --git a/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py b/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py index 304b0c977..00e126d88 100644 --- a/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py +++ b/core/iwasm/libraries/wasi-nn/test/run_smoke_test.py @@ -53,7 +53,7 @@ def execute_openvino_road_segmentation_adas_once( """ wasm_file = ( - "./openvino-road-seg-adas/target/wasm32-wasi/debug/openvino-road-seg-adas.wasm" + "./openvino-road-seg-adas/target/wasm32-wasip1/debug/openvino-road-seg-adas.wasm" ) wasm_args = [ "./model/road-segmentation-adas-0001.xml", @@ -70,7 +70,7 @@ def execute_openvino_mobilenet_raw_once( execute openvino-mobilenet-image with iwasm and wasmedge """ - wasm_file = "./rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-mobilenet.wasm" + wasm_file = "./rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-mobilenet.wasm" wasm_args = [ "mobilenet.xml", "mobilenet.bin", @@ -87,7 +87,7 @@ def execute_openvino_mobilenet_image_once( """ wasm_file = ( - "./rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-mobilenet-image.wasm" + "./rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-mobilenet-image.wasm" ) wasm_args = [ "mobilenet.xml", @@ -105,7 +105,7 @@ def execute_tflite_birds_v1_image_once( """ wasm_file = ( - "rust/target/wasm32-wasi/debug/wasmedge-wasinn-example-tflite-bird-image.wasm" + "rust/target/wasm32-wasip1/debug/wasmedge-wasinn-example-tflite-bird-image.wasm" ) wasm_args = ["lite-model_aiy_vision_classifier_birds_V1_3.tflite", "bird.jpg"] return execute_once(runtime_bin, runtime_args, wasm_file, wasm_args, cwd) @@ -262,7 +262,7 @@ def execute_openvino_road_segmentation_adas( def execute_wasmedge_ggml_qwen(iwasm_bin: str, wasmedge_bin: str, cwd: Path): iwasm_args = ["--dir=."] - wasm_file = ["./target/wasm32-wasi/debug/wasmedge-ggml-qwen.wasm"] + wasm_file = ["./target/wasm32-wasip1/debug/wasmedge-ggml-qwen.wasm"] wasm_args = ["./qwen1_5-0_5b-chat-q2_k.gguf"] cmd = [iwasm_bin] diff --git a/core/version.h b/core/version.h index 4fe37e2d7..d1becac61 100644 --- a/core/version.h +++ b/core/version.h @@ -3,9 +3,22 @@ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ +/* + * version.h.in is a template file. version.h is a generated file. + * Please do not edit both files directly. + * + * Any changes to the version should be done in build-scripts/version.cmake. + * + * Continue to maintain the version.h for certain embedded platforms. + */ + #ifndef _WAMR_VERSION_H_ #define _WAMR_VERSION_H_ + +/* clang-format off */ #define WAMR_VERSION_MAJOR 2 #define WAMR_VERSION_MINOR 2 #define WAMR_VERSION_PATCH 0 +/* clang-format on */ + #endif diff --git a/core/version.h.in b/core/version.h.in new file mode 100644 index 000000000..e28df65ce --- /dev/null +++ b/core/version.h.in @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2019 Intel Corporation. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +/* + * version.h.in is a template file. version.h is a generated file. + * Please do not edit both files directly. + * + * Any changes to the version should be done in build-scripts/version.cmake. + * + * Continue to maintain the version.h for certain embedded platforms. + */ + +#ifndef _WAMR_VERSION_H_ +#define _WAMR_VERSION_H_ + +/* clang-format off */ +#define WAMR_VERSION_MAJOR @WAMR_VERSION_MAJOR@ +#define WAMR_VERSION_MINOR @WAMR_VERSION_MINOR@ +#define WAMR_VERSION_PATCH @WAMR_VERSION_PATCH@ +/* clang-format on */ + +#endif diff --git a/doc/build_wasm_app.md b/doc/build_wasm_app.md index 9536d1a8d..95d237346 100644 --- a/doc/build_wasm_app.md +++ b/doc/build_wasm_app.md @@ -16,24 +16,24 @@ For [AssemblyScript](https://github.com/AssemblyScript/assemblyscript), please r For Rust, please refer to [Install Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) to install *cargo*, *rustc* and *rustup*. By default they are under ~/.cargo/bin. -And then run such a command to install `wasm32-wasi` target. +And then run such a command to install `wasm32-wasip1` target. ``` bash -$ rustup target add wasm32-wasi +$ rustup target add wasm32-wasip1 ``` To build WASM applications, run ``` bash -$ cargo build --target wasm32-wasi +$ cargo build --target wasm32-wasip1 ``` -The output files are under `target/wasm32-wasi`. +The output files are under `target/wasm32-wasip1`. To build a release version ``` bash -$ cargo build --release --target wasm32-wasi +$ cargo build --release --target wasm32-wasip1 ``` diff --git a/doc/semantic_version.md b/doc/semantic_version.md deleted file mode 100644 index 9fdd65d60..000000000 --- a/doc/semantic_version.md +++ /dev/null @@ -1,21 +0,0 @@ -# WAMR uses semantic versioning - -WAMR uses the _semantic versioning_ to replace the current _date versioning_ system. - -There are three parts in the new version string: - -- _major_. Any incompatible modification, on both ABI and APIs, will lead an increment - in the value of _major_. APIs includes: `wasm_export.h`, `wasm_c_api.h`, - _sections in AOT files_, and so on. -- _minor_. It represents new features. It includes not just MVP or POST-MVP features - but also WASI features and WAMR private ones. -- _patch_. It represents patches. - -## Legacy versions - -All legacy versions(tags) will keep their current status. No existing release names -and links will be changed. - -## Reference - -- [Semantic Versioning 2.0.0](https://semver.org/) diff --git a/doc/stability_release.md b/doc/stability_release.md new file mode 100644 index 000000000..78e034a3d --- /dev/null +++ b/doc/stability_release.md @@ -0,0 +1,33 @@ +# Semantic Versioning + +WAMR has adopted [semantic versioning](https://semver.org/) to replace the former *date versioning system*. The new version string consists of three parts: + +- *major*: Any change that is not compatible with previous versions, affecting either the ABI or APIs, will result in an increase in the major version number. APIs include: wasm_export.h, wasm_c_api.h, sections in AOT files, among others. +- *minor*: This number increases with the addition of new features. This encompasses not only MVP (Minimum Viable Product) or POST-MVP features but also WebAssembly System Interface (WASI) features and WAMR-specific features. +- *patch*: This number is incremented for patches. + +## Legacy releases + +All previous versions (tags) will retain their current status. There will be no changes to existing release names and links. + +# Release Process + +WAMR has been deployed across various devices. A frequent release cycle would strain customers' testing resources and add extra deployment work. Two factors can trigger a new WAMR release: + +- Community requests, particularly following the integration of significant and new features. +- Security vulnerabilities and critical bug fixes that ensure correctness. + +Patch releases will be made only to address security vulnerabilities and critical issues related to default behavior in prior releases. + +Once a release decision has been made: + +- Create a PR that: + 1. Modifies *build-scripts/version.cmake*. + 2. Executes cmake configuration to update the version. + 3. Updates *RELEASE_NOTES.md*. +- A checklist of the PR includes + - [ ] *build-scripts/version.cmake* + - [ ] *core/version.h* + - [ ] *RELEASE_NOTES.md* +- Once the PR is merged, create a new tag. +- Initiate the release process by triggering *the binary release processes* in *Actions*. diff --git a/doc/stability_wasm_proposals.md b/doc/stability_wasm_proposals.md index 98617d15b..715f2f3bd 100644 --- a/doc/stability_wasm_proposals.md +++ b/doc/stability_wasm_proposals.md @@ -35,7 +35,7 @@ Users can turn those features on or off by using compilation options. If a relev | Multiple memories[^3] | Yes | `WAMR_BUILD_MULTI_MEMORY` | | Reference-Typed Strings | No | `WAMR_BUILD_STRINGREF` | | Tail call | Yes | `WAMR_BUILD_TAIL_CALL` | -| Thread[^4] | Yes | `WAMR_BUILD_SHARED_MEMORY` | +| Threads[^4] | Yes | `WAMR_BUILD_SHARED_MEMORY` | | Typed Function References | Yes | `WAMR_BUILD_GC` | [^2]: diff --git a/product-mini/platforms/android/CMakeLists.txt b/product-mini/platforms/android/CMakeLists.txt index 5c0525917..19bc1b11e 100644 --- a/product-mini/platforms/android/CMakeLists.txt +++ b/product-mini/platforms/android/CMakeLists.txt @@ -107,6 +107,8 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -pie -fPIE") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security") @@ -135,6 +137,7 @@ endif() set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") +set_version_info (iwasm) add_custom_command (TARGET iwasm POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" diff --git a/product-mini/platforms/common/wasm_proposal.c b/product-mini/platforms/common/wasm_proposal.c new file mode 100644 index 000000000..4bf6ab3e9 --- /dev/null +++ b/product-mini/platforms/common/wasm_proposal.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2023 Amazon.com Inc. or its affiliates. All rights reserved. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + */ + +#include + +void +wasm_proposal_print_status(void) +{ + printf("About Wasm Proposals:\n"); + printf(" Always-on:\n"); + printf(" - Extended Constant Expressions\n"); + printf(" - Multi-value\n"); + printf(" - Non-trapping float-to-int conversions\n"); + printf(" - Sign-extension operators\n"); + printf(" - WebAssembly C and C++ API\n"); + printf(" Compilation Configurable. 0 is OFF. 1 is ON:\n"); + printf(" - Bulk Memory Operation via WASM_ENABLE_BULK_MEMORY: %u\n", + WASM_ENABLE_BULK_MEMORY); + printf(" - Fixed-Width SIMD via WASM_ENABLE_SIMD: %u\n", + WASM_ENABLE_SIMD); + printf(" - Garbage Collection via WASM_ENABLE_GC: %u\n", WASM_ENABLE_GC); + printf( + " - Legacy Exception Handling via WASM_ENABLE_EXCE_HANDLING: %u\n", + WASM_ENABLE_EXCE_HANDLING); + printf(" - Memory64 via WASM_ENABLE_MEMORY64: %u\n", + WASM_ENABLE_MEMORY64); + printf(" - Multiple Memory via WASM_ENABLE_MULTI_MEMORY: %u\n", + WASM_ENABLE_MULTI_MEMORY); + printf(" - Reference Types via WASM_ENABLE_REF_TYPES: %u\n", + WASM_ENABLE_REF_TYPES); + printf(" - Reference-Typed Strings via WASM_ENABLE_REF_TYPES: %u\n", + WASM_ENABLE_REF_TYPES); + printf(" - Tail Call via WASM_ENABLE_TAIL_CALL: %u\n", + WASM_ENABLE_TAIL_CALL); + printf(" - Threads via WASM_ENABLE_SHARED_MEMORY: %u\n", + WASM_ENABLE_SHARED_MEMORY); + printf(" - Typed Function References via WASM_ENABLE_GC: %u\n", + WASM_ENABLE_GC); + printf(" Unsupported (>= Phase4):\n"); + printf(" - Branch Hinting\n"); + printf(" - Custom Annotation Syntax in the Text Format\n"); + printf(" - Exception handling\n"); + printf(" - Import/Export of Mutable Globals\n"); + printf(" - JS String Builtins\n"); + printf(" - Relaxed SIMD\n"); +} diff --git a/product-mini/platforms/cosmopolitan/CMakeLists.txt b/product-mini/platforms/cosmopolitan/CMakeLists.txt index 8533ea68c..7676ea6fb 100644 --- a/product-mini/platforms/cosmopolitan/CMakeLists.txt +++ b/product-mini/platforms/cosmopolitan/CMakeLists.txt @@ -132,6 +132,7 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) check_pie_supported() add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) set_target_properties (vmlib PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (vmlib) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") @@ -160,6 +161,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) install (TARGETS iwasm DESTINATION bin) @@ -168,6 +171,8 @@ target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} ${WASI_NN add_library (libiwasm STATIC ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/darwin/CMakeLists.txt b/product-mini/platforms/darwin/CMakeLists.txt index 12ed8052f..1f955a10b 100644 --- a/product-mini/platforms/darwin/CMakeLists.txt +++ b/product-mini/platforms/darwin/CMakeLists.txt @@ -116,11 +116,14 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) @@ -131,5 +134,7 @@ install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) +set_version_info (libiwasm) + target_link_libraries (libiwasm ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) diff --git a/product-mini/platforms/freebsd/CMakeLists.txt b/product-mini/platforms/freebsd/CMakeLists.txt index dd1bbc41a..5640a384a 100644 --- a/product-mini/platforms/freebsd/CMakeLists.txt +++ b/product-mini/platforms/freebsd/CMakeLists.txt @@ -113,17 +113,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS} -lm -ldl -lpthread) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/ios/CMakeLists.txt b/product-mini/platforms/ios/CMakeLists.txt index ea5a4f4b9..ca54aa155 100644 --- a/product-mini/platforms/ios/CMakeLists.txt +++ b/product-mini/platforms/ios/CMakeLists.txt @@ -139,6 +139,7 @@ endif() set (distribution_DIR ${CMAKE_BINARY_DIR}/distribution) set_target_properties (iwasm PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${distribution_DIR}/wasm/lib") +set_version_info (iwasm) add_custom_command (TARGET iwasm POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy_directory "${WAMR_ROOT_DIR}/core/iwasm/include" "${distribution_DIR}/wasm/include/" diff --git a/product-mini/platforms/linux-sgx/CMakeLists.txt b/product-mini/platforms/linux-sgx/CMakeLists.txt index 20b3fdfac..927e6f459 100644 --- a/product-mini/platforms/linux-sgx/CMakeLists.txt +++ b/product-mini/platforms/linux-sgx/CMakeLists.txt @@ -107,6 +107,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) add_custom_command ( OUTPUT libvmlib_untrusted.a diff --git a/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt b/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt index aa3de6dac..a29dbd69c 100644 --- a/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt +++ b/product-mini/platforms/linux-sgx/CMakeLists_minimal.txt @@ -78,6 +78,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) add_custom_command ( OUTPUT libvmlib_untrusted.a diff --git a/product-mini/platforms/linux/CMakeLists.txt b/product-mini/platforms/linux/CMakeLists.txt index 321c4a955..527d18035 100644 --- a/product-mini/platforms/linux/CMakeLists.txt +++ b/product-mini/platforms/linux/CMakeLists.txt @@ -142,6 +142,7 @@ include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) check_pie_supported() add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) set_target_properties (vmlib PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (vmlib) set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") @@ -170,6 +171,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + set_target_properties (iwasm PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(iwasm @@ -185,6 +188,8 @@ install (TARGETS iwasm DESTINATION bin) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/posix/main.c b/product-mini/platforms/posix/main.c index af50223a4..fa5dcb2c3 100644 --- a/product-mini/platforms/posix/main.c +++ b/product-mini/platforms/posix/main.c @@ -18,6 +18,8 @@ #include "../common/libc_wasi.c" #endif +#include "../common/wasm_proposal.c" + #if BH_HAS_DLFCN #include #endif @@ -798,6 +800,8 @@ main(int argc, char *argv[]) wasm_runtime_get_version(&major, &minor, &patch); printf("iwasm %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n", major, minor, patch); + printf("\n"); + wasm_proposal_print_status(); return 0; } else { diff --git a/product-mini/platforms/riot/CMakeLists.txt b/product-mini/platforms/riot/CMakeLists.txt index 003283262..c32a0b977 100644 --- a/product-mini/platforms/riot/CMakeLists.txt +++ b/product-mini/platforms/riot/CMakeLists.txt @@ -62,3 +62,5 @@ include_directories(SYSTEM ${RIOT_INCLUDES_LIST}) # executable linking is done by RIOT build system add_library( wamr ${WAMR_RUNTIME_LIB_SOURCE}) + +set_version_info (wamr) diff --git a/product-mini/platforms/vxworks/CMakeLists.txt b/product-mini/platforms/vxworks/CMakeLists.txt index 0dc5d9699..dd03cb356 100644 --- a/product-mini/platforms/vxworks/CMakeLists.txt +++ b/product-mini/platforms/vxworks/CMakeLists.txt @@ -78,17 +78,22 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (vmlib) include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} -lm -ldl -lunix) add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME iwasm) diff --git a/product-mini/platforms/windows/CMakeLists.txt b/product-mini/platforms/windows/CMakeLists.txt index 40e925b16..ff438ee8c 100644 --- a/product-mini/platforms/windows/CMakeLists.txt +++ b/product-mini/platforms/windows/CMakeLists.txt @@ -106,6 +106,7 @@ set (WAMR_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../..) include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake) add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info(vmlib) #set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWIN32_LEAN_AND_MEAN") if (NOT MINGW) @@ -134,6 +135,8 @@ include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake) add_executable (iwasm main.c ${UNCOMMON_SHARED_SOURCE}) +set_version_info (iwasm) + install (TARGETS iwasm DESTINATION bin) target_link_libraries (iwasm vmlib ${LLVM_AVAILABLE_LIBS} ${UV_A_LIBS}) @@ -144,6 +147,8 @@ endif () add_library (libiwasm SHARED ${WAMR_RUNTIME_LIB_SOURCE}) +set_version_info (libiwasm) + install (TARGETS libiwasm DESTINATION lib) set_target_properties (libiwasm PROPERTIES OUTPUT_NAME libiwasm) diff --git a/samples/debug-tools/CMakeLists.txt b/samples/debug-tools/CMakeLists.txt index ce06029a5..411106bb3 100644 --- a/samples/debug-tools/CMakeLists.txt +++ b/samples/debug-tools/CMakeLists.txt @@ -72,7 +72,7 @@ add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE}) include(ExternalProject) # wasm32-wasi -ExternalProject_Add(wasm33-wasi +ExternalProject_Add(wasm32-wasi SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps" CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${CMAKE_CURRENT_SOURCE_DIR}/wasm-apps -B build -DWASI_SDK_PREFIX=${WASISDK_HOME} diff --git a/test-tools/wamr-ide/VSCode-Extension/resource/test/build.sh b/test-tools/wamr-ide/VSCode-Extension/resource/test/build.sh index e175c9106..33ae79d44 100755 --- a/test-tools/wamr-ide/VSCode-Extension/resource/test/build.sh +++ b/test-tools/wamr-ide/VSCode-Extension/resource/test/build.sh @@ -1,2 +1,2 @@ # compile with debug symbols and no optimization -rustc --target wasm32-wasi ./test.rs -g -C opt-level=0 \ No newline at end of file +rustc --target wasm32-wasip1 ./test.rs -g -C opt-level=0 \ No newline at end of file diff --git a/test-tools/wamr-ide/VSCode-Extension/src/test/suite/utils.ts b/test-tools/wamr-ide/VSCode-Extension/src/test/suite/utils.ts index 3f40596c3..69c474b25 100644 --- a/test-tools/wamr-ide/VSCode-Extension/src/test/suite/utils.ts +++ b/test-tools/wamr-ide/VSCode-Extension/src/test/suite/utils.ts @@ -39,7 +39,7 @@ export function setBpAtMarker(file: string, bpMarker: string): void { export function compileRustToWasm(): void { const testResourceFolder = `${EXTENSION_PATH}/resource/test`; // compile with debug symbols and no optimization - const cmd = `rustc --target wasm32-wasi ${testResourceFolder}/test.rs -g -C opt-level=0 -o ${testResourceFolder}/test.wasm`; + const cmd = `rustc --target wasm32-wasip1 ${testResourceFolder}/test.rs -g -C opt-level=0 -o ${testResourceFolder}/test.wasm`; try { cp.execSync(cmd, { stdio: [null, null, process.stderr] }); diff --git a/wamr-compiler/CMakeLists.txt b/wamr-compiler/CMakeLists.txt index bc56f4030..9975dab7b 100644 --- a/wamr-compiler/CMakeLists.txt +++ b/wamr-compiler/CMakeLists.txt @@ -58,6 +58,7 @@ if (WAMR_BUILD_LLVM_LEGACY_PM EQUAL 1) endif () if (LINUX) + set(WAMR_BUILD_LINUX_PERF 1) add_definitions(-DWASM_ENABLE_LINUX_PERF=1) endif () @@ -284,6 +285,7 @@ include (${IWASM_DIR}/common/gc/iwasm_gc.cmake) include (${IWASM_DIR}/interpreter/iwasm_interp.cmake) include (${IWASM_DIR}/aot/iwasm_aot.cmake) include (${IWASM_DIR}/compilation/iwasm_compl.cmake) +include (${PROJECT_SOURCE_DIR}/../build-scripts/version.cmake) if (WAMR_BUILD_LIBC_BUILTIN EQUAL 1) include (${IWASM_DIR}/libraries/libc-builtin/libc_builtin.cmake) @@ -375,6 +377,7 @@ add_library (aotclib ${IWASM_COMPL_SOURCE}) add_executable (wamrc main.c) check_pie_supported() set_target_properties (wamrc PROPERTIES POSITION_INDEPENDENT_CODE ON) +set_version_info (wamrc) if (LLVM_LINK_LLVM_DYLIB) set(WAMRC_LINK_LLVM_LIBS LLVM)