-
Notifications
You must be signed in to change notification settings - Fork 718
Sync with main #4570
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
base: gitbook
Are you sure you want to change the base?
Sync with main #4570
Conversation
`CMAKE_CURRENT_FUNCTION_LIST_DIR` is added in version 3.17 and currently most of `cmake_minimum_required()` with 3.14. Refer to https://cmake.org/cmake/help/latest/variable/CMAKE_CURRENT_FUNCTION_LIST_DIR.html
update workflows and scripts for Ubuntu 22.04 compatibility. It includes - install Intel SGX SDK 2.25 - use a reusable action to install sgx required - keep improve error handling in AOT compilation process in runtest.py add a workaround to fix receiving a shutdown signal problem. Refers to actions/runner-images#6680 and https://github.com/actions/runner-images/discussions/7188
There are two reasons for this optimization: - The value of dlen can equal 0x1_0000_0000, even in wasm32 mode, because it is derived from (4G-0). This results in a truncation when it is passed to b_memmove_s(). Consequently, s1max becomes 0 and n is greater than s1max. To correct this, a longer type is required. - The dlen is only used to check if there is enough space in b_memmove_s(). However, from a different angle, after confirming that both src+len and dst+len are within the memory range, we can be assured and there is no need for this explicit check.
…ions (#4202) Wrong type of arguments to formatting function.
Raise wasi-sdk to 25 and wabt to 1.0.37. It includes - Refactor CI workflow to install WASI-SDK and WABT from a composite action - Use ExternalProject to bring wasm-apps for few samples. file/ wasi-threads/ - Refactor sample build and test steps in SGX compilation workflow for improved clarity and efficiency (workaround) Add CMake support for EMSCRIPTEN and WAMRC, update module paths
Add missing V128 handling in WASM_OP_BR, reported in #4173
* Update gc unit test cases * Update aot stack frame unit test cases
LLVM 18 and later, instcombine perfoms only one iteration. it performs extra "verify fixpoint" operation when instcombine is specified in certain ways, including how we do so here. a problem is that the verification raises a fatal error when it finds we didn't reach a fixpoint: LLVM ERROR: Instruction Combining did not reach a fixpoint after 1 iterations while it should be rare, it's quite normal not to reach a fixpoint. this commit fixes the issue by simply disabing the verification. cf. llvm/llvm-project@4189584
for x86-64, llvm 17 and later sometimes uses "l" prefix for data sections. cf. llvm/llvm-project@4324937 because our aot file emitter/loader doesn't support such sections, it ends up with load-time errors solving symbols like ".lrodata". this commit fixes it by avoid placing data in the large data sections. references: https://groups.google.com/g/x86-64-abi/c/jnQdJeabxiU llvm/llvm-project@1feb00a
while ideally a user should not need to care this kind of optimization details, in reality i guess it's sometimes useful. both of clang and GCC expose a similar option. (-fno-jump-tables)
support llvm-jit running mode as another fuzzing target
LLVM, by default, disables the use of C++'s built-in Run-Time Type Information. This decision is primarily driven by concerns about code size and efficiency. But '-fsanitize=vptr' not allowed with '-fno-rtti'.
…4227) - set default value of WAMR_BUILD_REF_TYPES to 1 in CMakeLists.txt
…4240) LLVM 19 and later started to use srodata ("small read only data") sections for RISCV. cf. llvm/llvm-project#82214 this commit makes our aot emitter/loader deal with those sections. an alternative would be to disable small data sections completely by setting the "SmallDataLimit" module attribute to zero. however, i feel this commit is more straightforward and consisitent as we are already dealing with sdata sections.
Replace up_invalidate_dcache_all() with up_flush_dcache_all() in os_dcache_flush() to properly flush the data cache instead of just invalidating it. This ensures that any modified data in the cache is written back to memory before execution. Signed-off-by: Huang Qi <[email protected]>
Provide a triple string in the format of <arch>-<vendor>-<os>-<abi> via --target.
the corresponding LLVM intrinsics' return types are same as their first argument. eg. i64 for llvm.cttz.i64. cf. https://llvm.org/docs/LangRef.html#llvm-cttz-intrinsic this commit changes the return types of our versions of the intrinsics to match llvm versions as our aot compiler, specifically __call_llvm_intrinsic, assumes. strictly speaking, this is a potential AOT ABI change. however, I suppose it isn't a problem for many of 64-bit ABIs out there, where (lower half of) a 64-bit register is used to return a 32-bit value anyway. (for such ABIs, this commit would fix the upper 32-bit value of the register.)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.28.15 to 3.28.17. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](github/codeql-action@v3.28.15...v3.28.17) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.28.17 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
LLVM 16 and later expands cttz intrinsic to a table lookup, which involves some relocations. (unless ZBB is available, in which case the native instructions are preferred over the table-based lowering.) cf. https://reviews.llvm.org/D128911
- it's unused - valgrind is basically a linux-only software. it isn't a good idea to make it a hard requirement. if we want to use valgrind, it's better to introduce a separate option to control it.
…4092) * initialize WASI stdio handles to invalid for better error handling * implement os_invalid_raw_handle function for consistent invalid handle representation
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.8 to 3.29.10. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](github/codeql-action@v3.29.8...v3.29.10) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.29.10 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
build_wamr_wasi_extensions: | ||
runs-on: ${{ matrix.os }} | ||
permissions: | ||
contents: write # for uploading release artifacts |
Check failure
Code scanning / Scorecard
Token-Permissions High
Remediation tip: Visit https://app.stepsecurity.io/secureworkflow.
Tick the 'Restrict permissions for GITHUB_TOKEN'
Untick other options
NOTE: If you want to resolve multiple issues at once, you can visit https://app.stepsecurity.io/securerepo instead.
Click Remediation section below for further remediation help
working-directory: wamr-wasi-extensions/dist | ||
|
||
- name: Upload release zip | ||
uses: actions/upload-release-asset@v1 |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
@@ -0,0 +1,57 @@ | |||
# Copyright (C) 2019 Intel Corporation. All rights reserved. |
Check failure
Code scanning / Scorecard
Token-Permissions High
Remediation tip: Visit https://app.stepsecurity.io/secureworkflow.
Tick the 'Restrict permissions for GITHUB_TOKEN'
Untick other options
NOTE: If you want to resolve multiple issues at once, you can visit https://app.stepsecurity.io/securerepo instead.
Click Remediation section below for further remediation help
|
||
- name: Upload artifacts | ||
if: matrix.os == 'macos-14' | ||
uses: actions/upload-artifact@v4 |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Remediation tip: update your workflow using https://app.stepsecurity.io
Click Remediation section below for further remediation help
|
||
# If you modify this file, you may need to sync the modifications to the | ||
# .github/actions/setup-zephyr/action.yml | ||
FROM ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Remediation tip: pin your Docker image by updating ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch to ghcr.io/zephyrproject-rtos/ci-base:v0.26-branch@sha256:12f44f069809167ed9d3f1160ca0dbb5a5e9118df37f78092f790b29fb06d962
Click Remediation section below for further remediation help
RUN west update | ||
# Install west | ||
# hadolint ignore=DL3013,DL3059 | ||
RUN pip3 install --no-cache-dir west |
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium
Click Remediation section below to solve this issue
switch (flag) { | ||
case INIT_EXPR_TYPE_GET_GLOBAL: | ||
{ | ||
if (!check_global_init_expr(module, expr->u.unary.v.global_index, | ||
error_buf, error_buf_size)) { | ||
return false; | ||
} | ||
#if WASM_ENABLE_GC == 0 | ||
*value = module->import_globals[expr->u.unary.v.global_index] | ||
.global_data_linked; | ||
#else | ||
if (expr->u.unary.v.global_index < module->import_global_count) { | ||
*value = module->import_globals[expr->u.unary.v.global_index] | ||
.global_data_linked; | ||
} | ||
else { | ||
*value = module | ||
->globals[expr->u.unary.v.global_index | ||
- module->import_global_count] | ||
.init_expr.u.unary.v; | ||
} | ||
#endif | ||
break; | ||
} | ||
case INIT_EXPR_TYPE_I32_CONST: | ||
case INIT_EXPR_TYPE_I64_CONST: | ||
{ | ||
*value = expr->u.unary.v; | ||
break; | ||
} | ||
#if WASM_ENABLE_EXTENDED_CONST_EXPR != 0 | ||
case INIT_EXPR_TYPE_I32_ADD: | ||
case INIT_EXPR_TYPE_I32_SUB: | ||
case INIT_EXPR_TYPE_I32_MUL: | ||
case INIT_EXPR_TYPE_I64_ADD: | ||
case INIT_EXPR_TYPE_I64_SUB: | ||
case INIT_EXPR_TYPE_I64_MUL: | ||
{ | ||
WASMValue l_value, r_value; | ||
if (!get_init_value_recursive(module_inst, module, | ||
expr->u.binary.l_expr, &l_value, | ||
error_buf, error_buf_size)) { | ||
return false; | ||
} | ||
if (!get_init_value_recursive(module_inst, module, | ||
expr->u.binary.r_expr, &r_value, | ||
error_buf, error_buf_size)) { | ||
return false; | ||
} | ||
|
||
if (flag == INIT_EXPR_TYPE_I32_ADD) { | ||
value->i32 = l_value.i32 + r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_SUB) { | ||
value->i32 = l_value.i32 - r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_MUL) { | ||
value->i32 = l_value.i32 * r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_ADD) { | ||
value->i64 = l_value.i64 + r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_SUB) { | ||
value->i64 = l_value.i64 - r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_MUL) { | ||
value->i64 = l_value.i64 * r_value.i64; | ||
} | ||
break; | ||
} | ||
#endif | ||
default: | ||
return false; | ||
} |
Check notice
Code scanning / CodeQL
Long switch case Note
66 (45 lines)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 days ago
The code should be refactored so that the lengthy logic in the extended constant expression case block (lines 506–537) inside the switch-case at line 469 is split into a dedicated helper function. This helper function should compute the result of the arithmetic operation based on the flag
, left and right initializer expressions, almost exactly as is done in the original switch but abstracted into a separate location. The switch statement in get_init_value_recursive
should then call this new function for the relevant case, and only handle the return value and error reporting inline, cleaning up the case structure.
Required changes:
- In file core/iwasm/aot/aot_runtime.c
- Extract the logic from the block under
case INIT_EXPR_TYPE_I32_ADD:
etc. (lines 506–537) into a static helper function, e.g.bool eval_extended_const_expr(AOTModuleInstance*, AOTModule*, InitializerExpression*, WASMValue*, char*, uint32)
. - Replace the contents of the corresponding switch case with a call to the new helper function, handling its boolean result.
- Extract the logic from the block under
No new imports or dependencies are needed.
-
Copy modified lines R507-R508 -
Copy modified lines R517-R558 -
Copy modified line R560
@@ -504,36 +504,10 @@ | ||
case INIT_EXPR_TYPE_I64_SUB: | ||
case INIT_EXPR_TYPE_I64_MUL: | ||
{ | ||
WASMValue l_value, r_value; | ||
if (!get_init_value_recursive(module_inst, module, | ||
expr->u.binary.l_expr, &l_value, | ||
error_buf, error_buf_size)) { | ||
if (!eval_extended_const_expr(module_inst, module, expr, | ||
value, error_buf, error_buf_size)) { | ||
return false; | ||
} | ||
if (!get_init_value_recursive(module_inst, module, | ||
expr->u.binary.r_expr, &r_value, | ||
error_buf, error_buf_size)) { | ||
return false; | ||
} | ||
|
||
if (flag == INIT_EXPR_TYPE_I32_ADD) { | ||
value->i32 = l_value.i32 + r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_SUB) { | ||
value->i32 = l_value.i32 - r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_MUL) { | ||
value->i32 = l_value.i32 * r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_ADD) { | ||
value->i64 = l_value.i64 + r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_SUB) { | ||
value->i64 = l_value.i64 - r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_MUL) { | ||
value->i64 = l_value.i64 * r_value.i64; | ||
} | ||
break; | ||
} | ||
#endif | ||
@@ -542,7 +514,50 @@ | ||
} | ||
|
||
return true; | ||
/* Helper for evaluating extended constant expressions in get_init_value_recursive */ | ||
static bool | ||
eval_extended_const_expr(AOTModuleInstance *module_inst, AOTModule *module, | ||
InitializerExpression *expr, WASMValue *value, | ||
char *error_buf, uint32 error_buf_size) | ||
{ | ||
uint8 flag = expr->init_expr_type; | ||
WASMValue l_value, r_value; | ||
if (!get_init_value_recursive(module_inst, module, | ||
expr->u.binary.l_expr, &l_value, | ||
error_buf, error_buf_size)) { | ||
return false; | ||
} | ||
if (!get_init_value_recursive(module_inst, module, | ||
expr->u.binary.r_expr, &r_value, | ||
error_buf, error_buf_size)) { | ||
return false; | ||
} | ||
|
||
switch (flag) { | ||
case INIT_EXPR_TYPE_I32_ADD: | ||
value->i32 = l_value.i32 + r_value.i32; | ||
break; | ||
case INIT_EXPR_TYPE_I32_SUB: | ||
value->i32 = l_value.i32 - r_value.i32; | ||
break; | ||
case INIT_EXPR_TYPE_I32_MUL: | ||
value->i32 = l_value.i32 * r_value.i32; | ||
break; | ||
case INIT_EXPR_TYPE_I64_ADD: | ||
value->i64 = l_value.i64 + r_value.i64; | ||
break; | ||
case INIT_EXPR_TYPE_I64_SUB: | ||
value->i64 = l_value.i64 - r_value.i64; | ||
break; | ||
case INIT_EXPR_TYPE_I64_MUL: | ||
value->i64 = l_value.i64 * r_value.i64; | ||
break; | ||
default: | ||
return false; | ||
} | ||
return true; | ||
} | ||
} | ||
|
||
static bool | ||
global_instantiate(AOTModuleInstance *module_inst, AOTModule *module, |
shared_heap_start = | ||
is_memory64 ? heap->start_off_mem64 : heap->start_off_mem32; | ||
shared_heap_end = is_memory64 ? UINT64_MAX : UINT32_MAX; | ||
if (bytes - 1 > shared_heap_end || app_offset < shared_heap_start |
Check warning
Code scanning / CodeQL
Comparison result is always the same Warning
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 23 days ago
To fix the problem, remove the redundant comparison bytes - 1 > shared_heap_end
from line 644. The check does not make sense in the 32-bit case, as bytes - 1
can never exceed shared_heap_end
(UINT32_MAX
). The other two conditions (app_offset < shared_heap_start
and app_offset > shared_heap_end - bytes + 1
) are sufficient to check for out-of-bounds access. Only the relevant checks should remain to avoid confusion and improve code clarity.
Edit the file core/iwasm/common/wasm_memory.c
at the region around line 644, removing the unnecessary comparison.
No new imports, methods, or definitions are needed.
-
Copy modified line R644
@@ -641,7 +641,7 @@ | ||
shared_heap_start = | ||
is_memory64 ? heap->start_off_mem64 : heap->start_off_mem32; | ||
shared_heap_end = is_memory64 ? UINT64_MAX : UINT32_MAX; | ||
if (bytes - 1 > shared_heap_end || app_offset < shared_heap_start | ||
if (app_offset < shared_heap_start | ||
|| app_offset > shared_heap_end - bytes + 1) { | ||
goto fail; | ||
} |
switch (flag) { | ||
case INIT_EXPR_TYPE_GET_GLOBAL: | ||
{ | ||
if (!check_global_init_expr(module, expr->u.unary.v.global_index, | ||
error_buf, error_buf_size)) { | ||
goto fail; | ||
} | ||
|
||
*value = globals[expr->u.unary.v.global_index].initial_value; | ||
break; | ||
} | ||
case INIT_EXPR_TYPE_I32_CONST: | ||
case INIT_EXPR_TYPE_I64_CONST: | ||
{ | ||
*value = expr->u.unary.v; | ||
break; | ||
} | ||
#if WASM_ENABLE_EXTENDED_CONST_EXPR != 0 | ||
case INIT_EXPR_TYPE_I32_ADD: | ||
case INIT_EXPR_TYPE_I32_SUB: | ||
case INIT_EXPR_TYPE_I32_MUL: | ||
case INIT_EXPR_TYPE_I64_ADD: | ||
case INIT_EXPR_TYPE_I64_SUB: | ||
case INIT_EXPR_TYPE_I64_MUL: | ||
{ | ||
WASMValue l_value, r_value; | ||
if (!expr->u.binary.l_expr || !expr->u.binary.r_expr) { | ||
goto fail; | ||
} | ||
if (!get_init_value_recursive(module, expr->u.binary.l_expr, | ||
globals, &l_value, error_buf, | ||
error_buf_size)) { | ||
goto fail; | ||
} | ||
if (!get_init_value_recursive(module, expr->u.binary.r_expr, | ||
globals, &r_value, error_buf, | ||
error_buf_size)) { | ||
goto fail; | ||
} | ||
|
||
if (flag == INIT_EXPR_TYPE_I32_ADD) { | ||
value->i32 = l_value.i32 + r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_SUB) { | ||
value->i32 = l_value.i32 - r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_MUL) { | ||
value->i32 = l_value.i32 * r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_ADD) { | ||
value->i64 = l_value.i64 + r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_SUB) { | ||
value->i64 = l_value.i64 - r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_MUL) { | ||
value->i64 = l_value.i64 * r_value.i64; | ||
} | ||
break; | ||
} | ||
#endif /* end of WASM_ENABLE_EXTENDED_CONST_EXPR != 0 */ | ||
default: | ||
goto fail; | ||
} |
Check notice
Code scanning / CodeQL
Long switch case Note
66 (48 lines)
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 days ago
To fix this problem, we'll extract the extended constant expression handling logic from the enormous switch case into a separate static helper function. Specifically, the handling for:
INIT_EXPR_TYPE_I32_ADD
INIT_EXPR_TYPE_I32_SUB
INIT_EXPR_TYPE_I32_MUL
INIT_EXPR_TYPE_I64_ADD
INIT_EXPR_TYPE_I64_SUB
INIT_EXPR_TYPE_I64_MUL
will be moved into a new function, e.g., static bool eval_extended_const_expr(...)
. The switch will simply invoke this helper for those cases. We'll pass all needed arguments (the module, global list, expr, value out, error_buf, error_buf_size) and return whether evaluation succeeded.
Only the code in the switch case for extended constant expressions will move out; all other cases remain unchanged. We'll place the helper function just above get_init_value_recursive()
so it is visible only in this translation unit. The full context of code movement and replacement will be made explicit.
-
Copy modified lines R1169-R1214 -
Copy modified line R1245
@@ -1166,6 +1166,52 @@ | ||
#endif | ||
|
||
static bool | ||
eval_extended_const_expr(WASMModule *module, InitializerExpression *expr, | ||
WASMGlobalInstance *globals, WASMValue *value, | ||
char *error_buf, uint32 error_buf_size) | ||
{ | ||
uint8 flag = expr->init_expr_type; | ||
WASMValue l_value, r_value; | ||
|
||
if (!expr->u.binary.l_expr || !expr->u.binary.r_expr) { | ||
return false; | ||
} | ||
if (!get_init_value_recursive(module, expr->u.binary.l_expr, | ||
globals, &l_value, error_buf, | ||
error_buf_size)) { | ||
return false; | ||
} | ||
if (!get_init_value_recursive(module, expr->u.binary.r_expr, | ||
globals, &r_value, error_buf, | ||
error_buf_size)) { | ||
return false; | ||
} | ||
|
||
if (flag == INIT_EXPR_TYPE_I32_ADD) { | ||
value->i32 = l_value.i32 + r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_SUB) { | ||
value->i32 = l_value.i32 - r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_MUL) { | ||
value->i32 = l_value.i32 * r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_ADD) { | ||
value->i64 = l_value.i64 + r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_SUB) { | ||
value->i64 = l_value.i64 - r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_MUL) { | ||
value->i64 = l_value.i64 * r_value.i64; | ||
} | ||
else { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
static bool | ||
get_init_value_recursive(WASMModule *module, InitializerExpression *expr, | ||
WASMGlobalInstance *globals, WASMValue *value, | ||
char *error_buf, uint32 error_buf_size) | ||
@@ -1196,39 +1242,9 @@ | ||
case INIT_EXPR_TYPE_I64_SUB: | ||
case INIT_EXPR_TYPE_I64_MUL: | ||
{ | ||
WASMValue l_value, r_value; | ||
if (!expr->u.binary.l_expr || !expr->u.binary.r_expr) { | ||
if (!eval_extended_const_expr(module, expr, globals, value, error_buf, error_buf_size)) { | ||
goto fail; | ||
} | ||
if (!get_init_value_recursive(module, expr->u.binary.l_expr, | ||
globals, &l_value, error_buf, | ||
error_buf_size)) { | ||
goto fail; | ||
} | ||
if (!get_init_value_recursive(module, expr->u.binary.r_expr, | ||
globals, &r_value, error_buf, | ||
error_buf_size)) { | ||
goto fail; | ||
} | ||
|
||
if (flag == INIT_EXPR_TYPE_I32_ADD) { | ||
value->i32 = l_value.i32 + r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_SUB) { | ||
value->i32 = l_value.i32 - r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I32_MUL) { | ||
value->i32 = l_value.i32 * r_value.i32; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_ADD) { | ||
value->i64 = l_value.i64 + r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_SUB) { | ||
value->i64 = l_value.i64 - r_value.i64; | ||
} | ||
else if (flag == INIT_EXPR_TYPE_I64_MUL) { | ||
value->i64 = l_value.i64 * r_value.i64; | ||
} | ||
break; | ||
} | ||
#endif /* end of WASM_ENABLE_EXTENDED_CONST_EXPR != 0 */ |
#include "../common/libc_wasi.c" | ||
#endif | ||
|
||
#include "../common/wasm_proposal.c" |
Check notice
Code scanning / CodeQL
Include header files only Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 23 days ago
To fix this problem, the code should not include the .c
source file directly. Instead, the declarations (function prototypes, types, etc.) from wasm_proposal.c
should be moved to a new header file, for example, wasm_proposal.h
. The source file wasm_proposal.c
should then be compiled separately and linked as part of the build process. In main.c
, replace #include "../common/wasm_proposal.c"
with #include "../common/wasm_proposal.h"
. This change should be made only in the code shown (i.e., in main.c
), and assumes that the build system will be updated to compile wasm_proposal.c
as a separate compilation unit.
-
Copy modified line R21
@@ -18,7 +18,7 @@ | ||
#include "../common/libc_wasi.c" | ||
#endif | ||
|
||
#include "../common/wasm_proposal.c" | ||
#include "../common/wasm_proposal.h" | ||
|
||
#if BH_HAS_DLFCN | ||
#include <dlfcn.h> |
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 5. - [Release notes](https://github.com/actions/checkout/releases) - [Commits](actions/checkout@v3...v5) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Add Android macro check for indirect mode
core/iwasm/libraries/wasi-nn/test/build.sh: set -e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scorecard found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
Signed-off-by: zhenweijin <[email protected]>
zephyr: Enable WASI support for file system and sockets on zephyr (#3633) This work also implements the WASI support on Zephyr. * Added os_is_* methods for stdin/stdout/stderr. Fixed issues in os_renameat * Zephyr platform fixes for WASI sockets Addressed numerous of build warnings on Zephyr * Updated `os_writev` to use `fwrite` for STDOUT/STDERR * Temporarily reverted change to `writev` to work around an issue. * Fixes: fstat, fstatat, and unlink * Add initial support for directories in os_openat. Partial implementation — just avoids a hard fault. * Directory support WIP. readdir works but I think we have a memory leak somewhere * Fix: always use standard stream fds. Fix unlinkat and renameat. fd 0, 1, and 2 will always be supplied for standard streams. Unlinkat and renameat work exclusively based on supplied paths. * Fix: use macro for free() * Added a temporary workaround for issue identified in PR#4377 * Fixed reference to file descriptor and cleaned up dead/commented code. Note that some comments haven't been addressed and will be fixed in the further patches. Signed-off-by: Stephen Berard <[email protected]> Co-authored-by: Lucas Abad <[email protected]> Co-authored-by: Stephen Berard <[email protected]> Co-authored-by: Dan Kouba <[email protected]>
…ctions (#4582) ``` comparison of integer expressions of different signedness: ‘__wasi_fd_t’ {aka ‘int’} and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] 288 | if (fd >= pt->size) ```
…4580) Bumps [requests](https://github.com/psf/requests) from 2.32.4 to 2.32.5. - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](psf/requests@v2.32.4...v2.32.5) --- updated-dependencies: - dependency-name: requests dependency-version: 2.32.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.10 to 3.29.11. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](github/codeql-action@v3.29.10...v3.29.11) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.29.11 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: zhenweijin <[email protected]>
Correct the build command typo in the doc
This is a preparation for #4364 No functional changes are intended.
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 4 to 5. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](actions/setup-node@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-node dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.11 to 3.30.1. - [Release notes](https://github.com/github/codeql-action/releases) - [Commits](github/codeql-action@v3.29.11...v3.30.1) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.30.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…t, rt-thread, zephyr platform (#4604)
The issue was previously covered by WAMR_BUILD_LIBC_BUILTIN and WAMR_BUILD_LIBC_WASI. Reproduced by ``` $ cmake -S . -B build -DWAMR_BUILD_SHARE_HEAP=1 -DWAMR_BUILD_LIBC_BUILTIN=0 -DWAMR_BUILD_LIBC_WASI=0 $ cmake --build build ```
- Apply global warnings in warnings.cmake instead of maintaining them in separate files. - Enable errors during CI when building iwasm and wamrc. - Since GCC and Clang are the default compilers on Ubuntu and macOS, enabling `-Werror` on both platforms can be treated as checking with different compilers.
No description provided.