Commit Graph

1990 Commits

Author SHA1 Message Date
b00904b092 Add a comment on AOT_SECTION_TYPE_SIGNATURE (#3746)
cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/3744
2024-08-22 12:35:25 +08:00
67dce48201 Enable merged os_mmap for aot data sections and aot text (#3743)
Enable merged os_mmap for aot data sections first, and try enabling merged
os_mmap for them and aot text except on platform nuttx and esp-idf.

This fixes the issue that aarch64 AOT module fails to load on android:
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2274

And also refine os_mmap related code.
2024-08-21 12:55:34 +08:00
1329e1d3e1 Add support for multi-memory proposal in classic interpreter (#3742)
Implement multi-memory for classic-interpreter. Support core spec (and bulk memory) opcodes now,
and will support atomic opcodes, and add multi-memory export APIs in the future. 

PS: Multi-memory spec test patched a lot for linking test to adapt for multi-module implementation.
2024-08-21 12:22:23 +08:00
f4383a9e62 Use node 18.x to build vscode extension (#3735)
Fix the issue of releasing wamr-ide vscode extension:
https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/10467675321/job/28987014745
2024-08-20 17:03:28 +08:00
d67cc26d56 Fix load error not reported when magic header is invalid (#3734)
When AOT isn't enabled and the input is a wasm file, wasm_runtime_load doesn't
report error. Same when interpreter isn't enabled and the input is AOT file.

This PR makes wasm_runtime_load report error "magic header not detected" for
such situations.
2024-08-20 16:03:04 +08:00
c04ef6b44f Update version to 2.1.2 and update release notes (#3718) 2024-08-20 12:00:39 +08:00
6fdad9916f riscv: Add missing relocation intrinsics for __fixdfsi/__ltdf2 (#3733) 2024-08-20 11:06:07 +08:00
581e1d9767 compilation: Use the dedicated stack-sizes section only for AOT (#3732)
For JIT, we naturally use mach-o on macOS, where the section name
we currently use is not valid and ends up with the errors like:

```
LLVM ERROR: Global variable '__orc_lcl.aot_stack_sizes.0' has an invalid section specifier '.aot_stack_sizes': mach-o section specifier requires a segment and section separated by a comma.
```

Because the dedicated section is not necessary for JIT,
this commit simply stops using it.

Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/3730
2024-08-20 10:26:26 +08:00
97c95a2e2f Fix table idx resolving in op call_indirect/return_call_indirect (#3726)
The table index in the call_indirect/return_call_indirect opcode should be
one byte 0x00 when ref-types/GC isn't enabled, and should be treated as
leb u32 when ref-types/GC is enabled.

And make aot compiler bail out if ref-types/GC is disabled by command line
argument while ref-types instructions are used.
2024-08-19 10:57:36 +08:00
88caa0c53a CI: Unify configuration stage for NuttX (#3725) 2024-08-19 10:35:18 +08:00
67c33a29e3 CI: Enable XIP spectest for RISCV32 ILP32F (#3727) 2024-08-19 09:52:38 +08:00
4c127715df aot compiler: Fix NaN handling for opcode f32/f64.const in XIP mode (#3721)
If the value of a float constant is an NaN, the aot compiler creates an alloca,
stores the converted i32 const into it and then loads f32 from it again, which
may introduce a relocation in the AOT file and is not allowed for XIP mode.
2024-08-16 14:04:41 +08:00
59f761b58d aot compiler: Track non-0x00 tableindex as ref types use (#3695)
Any use of a table index that isn't exactly a null byte (`0x00`) means that
the module makes use of the reference types proposal. This is important
to track because `aot_compiler.c` will blindly assume that all table indices
are a single byte long otherwise.

This fixes a crash in WAMR for modules that contain multi-byte encodings
of table indices in `call_indirect` but make no other use of reference types
features.
2024-08-16 12:37:10 +08:00
a44c487632 runtest.py: Normallize option handling for XIP mode (#3722) 2024-08-16 11:33:51 +08:00
63df2cf02d Update std atomic check and simd compatibility check for arc compiler (#3716) 2024-08-16 10:12:23 +08:00
b845e2ede4 Add missing headers in bh_atomic.h and aot_llvm_extra.cpp (#3715) 2024-08-16 06:56:49 +08:00
58ca02bc5f Add support for RISCV32 ILP32F (#3708) 2024-08-15 15:17:42 +08:00
000680f090 NuttX: Retire CONFIG_ARCH_RV32IM and CONFIG_ARCH_RV64GC (#3717)
These symbols had been removed from NuttX in 2022, so it's time to
remove references to them.
2024-08-15 14:49:50 +08:00
740f499e9c Fix potential memory leak in insert_native_symbol (#3712) 2024-08-14 18:11:18 +08:00
cce48a0943 test_wamr.sh: Fix build wabt tool (#3703)
And fix a typo in ATTRIBUTIONS.md.
2024-08-14 16:20:32 +08:00
5b8dfbce75 Fix compilation warnings (#3707)
Compilation warnings were reported on mac:
```
core/shared/mem-alloc/ems/ems_gc.c:454:22: warning: passing arguments to 'wasm_runtime_gc_prepare' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
    gct_vm_gc_prepare(NULL);
                     ^
core/shared/mem-alloc/ems/ems_gc.c:466:23: warning: passing arguments to 'wasm_runtime_gc_finalize' without a prototype is deprecated in all versions of C and is not supported in C2x [-Wdeprecated-non-prototype]
    gct_vm_gc_finished(NULL);
                      ^
2 warnings generated.
```
2024-08-14 16:08:10 +08:00
da25906ed4 debug-interp: Only add lock when signal_flag is SIG_SINGSTEP (#3704)
As reported in #3500, when debug interpreter is enabled, the classic interpreter
performs a lock operation to read `exec_env->current_status->signal_flag` and
do further handling before fetching next opcode, which makes the interpreter
run slower.

This PR atomic loads the `exec_env->current_status->signal_flag` without mutex
lock when 32-bit atomic load is supported, and only adding lock for further
handling when the signal_flag is WAMR_SIG_SINGSTEP, which improves the
performance.
2024-08-14 09:03:01 +08:00
37d7439ef9 [refactoring] Extract read leb to a separate file, share the code between loader and mini loader (#3701)
There's probably a number of other places where the bh_leb_read could be used (e.g. aot loader)
but I'm making the change as small as possible. Further refactoring can be done later.
2024-08-14 08:46:24 +08:00
a83adccd20 libc-builtin: Fix function prototype for wasm_runtime_module_realloc (#3702)
Fix:
```
wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:20:1:
  warning: type of 'wasm_runtime_module_realloc' does not match original declaration [-Wlto-type-mismatch]
wamr/core/iwasm/common/wasm_runtime_common.c:3033:1:
  note: return value type mismatch
wamr/core/iwasm/common/wasm_runtime_common.c:3033:1:
  note: type 'uint64' should match type 'uint32'
wamr/core/iwasm/common/wasm_runtime_common.c:3033:1:
  note: 'wasm_runtime_module_realloc' was previously declared here
wamr/core/iwasm/common/wasm_runtime_common.c:3033:1:
  note: code may be misoptimized unless '-fno-strict-aliasing' is used
```
2024-08-13 17:44:58 +08:00
67fa155878 libc-wasi: Make rights of STDIN/STDOUT/STDERR fixed and overlook their access modes (#3694)
When determining the file descriptor rights in the function fd_determine_type_rights(),
we assign fixed and unchangeable rights to STDIN, STDOUT and STDERR.

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3686
2024-08-13 10:10:22 +08:00
140ff25d46 wasi-nn: Apply new architecture (#3692)
ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3677
2024-08-13 09:14:52 +08:00
4e31bd63b7 wamr-test-suites: Clean up generated tmp files after spec test (#3700)
Add all possible generated tmp files to the list, those not actually generated
will be simply ignored in the deletion process.
2024-08-13 08:38:15 +08:00
da31c079b2 posix_thread.c: Restore old signal alternate stack before thread exit (#3693)
Some host environment may also create an signal alternate stack and access
it after the wasm runtime exits, the runtime should backup the stack info and
restore it before thread exits.

The issue was found in golang:
```
signal 23 received on thread with on signal stack
fatal error: non-Go code disabled signaltstack
```
2024-08-12 12:48:25 +08:00
1362a305f4 Restore linux iwasm default visibility (#3691)
Revert commit 6d8d60d0f0c53d5fb2477506a33bb7308b08596b:
"Set linux iwasm default visibility to hidden also"

Address comments for pull request #3655.
2024-08-07 15:12:38 +08:00
6ddaecafb3 wamrc: Add some help text for --size-level (#3689) 2024-08-07 13:43:47 +08:00
8a2e151de1 CI: Bump NuttX version to 12.6 (#3684) 2024-08-05 09:06:31 +08:00
c3dd5598f6 Fix a compilation warning (#3682)
Fix:
```
wamr/core/iwasm/compilation/aot_llvm.c: In function ‘insert_native_symbol’:
wamr/core/iwasm/compilation/aot_llvm.c:3290:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
 3290 |     if (ret < 0 || ret + 1 > sizeof(sym->symbol)) {
      |                            ^
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-08-03 21:05:18 +08:00
3ce242b5db spec-test-script/runtest.py: Use wamrc --xip option for xip (#3683) 2024-08-02 21:26:18 +08:00
08fad88d75 spec_test_on_nuttx.yml: Retire CONFIG_EOL_IS_LF (#3676)
It has been removed in nuttx while ago:
https://github.com/apache/nuttx/pull/8628
2024-08-02 09:54:07 +08:00
0a56abc6d6 build(deps): bump tensorflow in /core/iwasm/libraries/wasi-nn/test (#3675)
Bumps [tensorflow](https://github.com/tensorflow/tensorflow) from 2.11.1 to 2.12.1.
- [Release notes](https://github.com/tensorflow/tensorflow/releases)
- [Changelog](https://github.com/tensorflow/tensorflow/blob/master/RELEASE.md)
- [Commits](https://github.com/tensorflow/tensorflow/compare/v2.11.1...v2.12.1)

---
updated-dependencies:
- dependency-name: tensorflow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-02 09:17:12 +08:00
c3bd6b495b spec_test_on_nuttx.yml: Replace sed with kconfig-tweak (#3672)
Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/3646
2024-07-31 09:45:11 +08:00
6be4b53bdf Add emscripten_sleep() wrapper to libc-emcc (#3669) 2024-07-30 10:52:44 +08:00
a9cd8ba87a Set posix thread name for debug build (#3657) 2024-07-30 07:50:34 +08:00
3b56e7c607 spec_test_on_nuttx.yml: Record more logs (#3670)
Upload artifacts including nuttx config/image and wasm/aot modules
for post-mortem investigations.
2024-07-27 15:38:24 +08:00
84b5221517 spec_test_on_nuttx.yml: Enable xip (#3671)
Related changes:
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3662
https://github.com/bytecodealliance/wasm-micro-runtime/pull/3666
2024-07-27 15:31:31 +08:00
4c5f35b0e3 Zephyr User Mode Support (#3650)
Add support for the [Zephyr Usermode](https://docs.zephyrproject.org/latest/kernel/usermode/index.html)
to the Zephyr port.

The following changes are applied:
- Fix `signbit`, check if it is defined already and only implement it, if not
- Introduce `sys_mutex` and `sys_sem` in favour of `k_mutex` and `k_sem`, when `CONFIG_USERMODE` is enabled
- Remove the installation of the `_stdout_hook_iwasm()` when `CONFIG_USERMODE` is enabled, otherwise this
  causes MPU errors since the std hook is in the kernel space
- Add a thread name for debugging
2024-07-26 20:16:57 +08:00
22df091603 spec_test_on_nuttx.yml: Add xtensa (#3665)
Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/3608.
2024-07-26 14:14:04 +08:00
6e727dc18d Support more features for rt-thread (#3661)
1, enable thread mgr
2, enable libc wasi
3, enable libc wasi threads
4, specify a function name of the module to run rather main
2024-07-26 10:34:15 +08:00
4dfdbbb5a5 spec-test-script: Use -mtext-section-literals for xtensa xip (#3666) 2024-07-26 09:40:22 +08:00
83b36558a7 spec-test-script: Skip a few tests for xtensa qemu (#3664)
Because these test cases require more memory than what nuttx on esp32s3 qemu can afford.
2024-07-25 11:59:31 +08:00
2f147fae96 aot compiler: Bail out on too long native symbol names (#3663)
The old code was silently truncating long names.
2024-07-25 11:38:29 +08:00
a055e0b26f aot compiler: Enlarge AOTNativeSymbol->symbol (#3662)
The old value was not enough for wasm_externref_obj_to_internal_obj,
which is 34 characters long.
2024-07-25 11:21:07 +08:00
c05b93f992 aot runtime: Add missing arm/thumb relocations (#3660) 2024-07-25 11:06:41 +08:00
b21e3fd2fa wamr-compiler: Avoid size-level tweak if target is specified (#3659)
If target is specified, assume a cross-build.

Partly fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/3356
2024-07-25 10:39:48 +08:00
b300797b71 wamrc: Add --mllvm= option (#3658)
This allows users to specify llvm command line options, similarly to clang's -mllvm option.

My motivations:
* -debug and friends
* -mtext-section-literals for xtensa
2024-07-24 20:25:45 +08:00