Commit Graph
42 Commits
Author SHA1 Message Date
YAMAMOTO TakashiandGitHub 3168ba8dcf Add comments on trailing uint8[1] members in the "Common" structures (#1189)
Add comments to avoid abusing these members to store extra data.
2022-05-26 11:53:50 +08:00
YAMAMOTO TakashiandGitHub 3fd763a95c wasm_export.h: Make RuntimeInitArgs less config dependent (#1190)
This header file is supposed to be used by user code, which is not
a part of WAMR. Usually WAMR configuration is not available there,
remove DEBUG_INTERP macro control in it.
2022-05-25 18:15:51 +08:00
YAMAMOTO TakashiandGitHub 2288695a33 product-mini/platforms/nuttx/wamr.mk: Build libc-wasi (#1129) 2022-05-24 16:12:08 +08:00
YAMAMOTO TakashiandGitHub da3b519642 core/shared/platform/nuttx: mock several APIs for libc-wasi (#1127) 2022-05-24 12:03:40 +08:00
YAMAMOTO TakashiandGitHub 723a808106 nuttx: Use text heap for executable memory (#1181)
Based on nuttx patch "Add up_textheap_heapmember":
  https://github.com/apache/incubator-nuttx/pull/6306
2022-05-23 10:58:09 +08:00
YAMAMOTO TakashiandGitHub 69c23aa2d4 aot_reloc_xtensa.c: define __packed if not available (#1179) 2022-05-21 16:46:02 +08:00
YAMAMOTO TakashiandGitHub c47b318aef nuttx: add CONFIG_INTERPRETERS_WAMR_PERF_PROFILING (#1178)
Based on the corresponding nuttx patch:
  https://github.com/apache/incubator-nuttx-apps/pull/1166
2022-05-21 14:56:56 +08:00
YAMAMOTO TakashiandGitHub a50011a4dd core/iwasm/common/wasm_application.c: Fix a typo of macro (#1180)
Change WAMR_ENABLE_PERF_PROFILING to WASM_ENABLE_PERF_PROFILING
2022-05-21 12:53:11 +08:00
YAMAMOTO TakashiandGitHub 362bd0cc5c doc/wasm_c_api.md: Mention relationship with wasm_export.h (#1159) 2022-05-09 16:39:49 +08:00
YAMAMOTO TakashiandGitHub 3edb832f76 aot_reloc_arm.c: Implement R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS (#1148)
Implement reloc type R_ARM_MOVW_ABS_NC and R_ARM_MOVT_ABS for arm,
refer to:
https://github.com/ARM-software/abi-aa/blob/main/aaelf32/aaelf32.rst#5614static-arm-relocations
2022-05-07 10:22:05 +08:00
YAMAMOTO TakashiandGitHub 8db6f5978b aot_emit_aot_file.c: Convert switch lookup table relocation (#1149)
Fix the symbol resolving failure with recent version of wamrc:
```
AOT module load failed: resolve symbol .Lswitch.table.aot _func#82.2 failed
```
Replace the relocations for such symbols with .rodata section.
2022-05-07 08:41:53 +08:00
YAMAMOTO TakashiandGitHub 6fb402aeec wasm_export.h: Add a few comments about heap and threads (#1147) 2022-05-06 18:30:48 +08:00
YAMAMOTO TakashiandGitHub 03f2153270 wasm_runtime_common.c: add assertion for BH_MALLOC/BH_FREE (#1139)
Add assertion for BH_MALLOC/BH_FREE in wasm_runtime_common.c,
when building runtime, the BH_MALLOC/BH_FREE macros should be
defined as wasm_runtime_malloc/wasm_runtime_free.
2022-05-06 13:47:56 +08:00
YAMAMOTO TakashiandGitHub 2e27d506d8 posix os_socket_inet_network: Use inet_addr instead of inet_network (#1133) 2022-04-28 13:53:01 +08:00
YAMAMOTO TakashiandGitHub d9d0777051 Move dlfcn.h availability check to platform_common.h (#1134) 2022-04-28 12:31:28 +08:00
YAMAMOTO TakashiandGitHub 814a76ee89 product-mini/platforms/nuttx/wamr.mk: Provide BH_MALLOC/BH_FREE (#1135) 2022-04-28 12:03:29 +08:00
YAMAMOTO TakashiandGitHub f8b4ca2a70 sandboxed-system-primitives: Remove unused file signals.h (#1132) 2022-04-27 18:59:09 +08:00
YAMAMOTO TakashiandGitHub e1934f2478 sandboxed-system-primitives: Use d_ino=0 for NuttX (#1128)
NuttX doesn't have d_ino.
2022-04-27 17:49:06 +08:00
YAMAMOTO TakashiandGitHub 5343411623 libc-wasi/sandboxed-system-primitives: Convert signals only when available (#1125)
Many of these signal constants are not available on NuttX.

Maybe we can remove these signal stuff sooner or later:
    https://github.com/WebAssembly/WASI/issues/7
    https://github.com/WebAssembly/wasi-libc/pull/278
2022-04-27 16:22:43 +08:00
YAMAMOTO TakashiandGitHub 2fe83e29cd sandboxed-system-primitives: make CPT/TCT clock ids optional (#1126)
NuttX doesn't have them.
2022-04-27 14:24:02 +08:00
YAMAMOTO TakashiandGitHub 91222e1e44 interpreter: Fix an UBSan complaint in word_copy (#1106)
Fix an UBSan complaint introduced by recent change by adding more checks
to word_copy:
```
wasm_interp_fast.c:792:9: runtime error: applying zero offset to null pointer
```
2022-04-21 12:21:37 +08:00
YAMAMOTO TakashiandGitHub 67d6a2886e core/iwasm/aot/aot_loader.c: Fix a zero-sized malloc warning (#1108)
Fix the following warning when loading an aot file without relocations:
```
[20:19:00:528 - 1119F1600]: warning: wasm_runtime_malloc with size zero
```
2022-04-20 18:27:13 +08:00
YAMAMOTO TakashiandGitHub a85f982297 wamr-compiler: Fix ubsan on macOS (#1105)
Supported on ubuntu as well
2022-04-20 16:59:13 +08:00
YAMAMOTO TakashiandGitHub 0f505aafd9 aot_runtime.c: Add static assertions for some offset assumptions (#1103) 2022-04-20 13:58:02 +08:00
YAMAMOTO TakashiandGitHub b36931a589 aot_loader.c: Fix issues in "Refine interp/aot string storage" (#1102)
Fix issues in PR "Refine interp/aot string storage and emitting (#820)",
which had a few issues:
- It looks a wrong byte to mark the flag
- It doesn't work for long strings (>= 0x80 in case of little endian)

This commit fixes them by maintaining a list of loaded symbols while loading
relocation section to avoid reading a string repeatedly, and no need to mark
the flag again.
2022-04-19 15:44:30 +08:00
YAMAMOTO TakashiandGitHub 87784cfb65 core/iwasm/aot/aot_runtime.c: Fix an unused function warning (#1099) 2022-04-19 09:48:28 +08:00
YAMAMOTO TakashiandGitHub b4574123c9 aot_get_module_mem_consumption: Fix const strings size (#1098)
Fix the issue that the `*(uint32 *)p_const_string_size` is added repeatedly
while calculating the aot module's memory consumption.
2022-04-19 08:57:44 +08:00
YAMAMOTO TakashiandGitHub 2366e8c493 Fix a few signedness warnings (#1095)
Fix compile warnings in libc-wasi posix.c:
```
posix.c:880:41: warning: comparison of integers of different signs:
 'unsigned long' and 'ssize_t' (aka 'long') [-Wsign-compare]
            if (bufoff + iov[i].buf_len < len) {
posix.c:1359:32: warning: comparison of integers of different signs:
 'off_t' (aka 'long long') and 'unsigned long long' [-Wsign-compare]
    if (ret == 0 && sb.st_size < offset + len)
```
2022-04-18 16:54:15 +08:00
YAMAMOTO TakashiandGitHub 6edabbf632 Add __umoddi3 to target symbol map in aot_reloc_arm.c (#828) 2021-11-10 16:53:14 +08:00
YAMAMOTO TakashiandGitHub d1be75c4a1 wamrc: return a non-zero exit code on failure (#822) 2021-11-09 13:13:20 +08:00
YAMAMOTO TakashiandGitHub 2613a68108 aot_reloc_x86_64: Fix pointer overflows (#809)
Fix pointer overflow of `(uint8 *)symbol_addr + reloc_addend` detected by UBSan:
```
core/iwasm/aot/arch/aot_reloc_x86_64.c:232:43: runtime error: addition of unsigned offset to 0x000041209004 overflowed to 0x000041209000
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior core/iwasm/aot/arch/aot_reloc_x86_64.c:232:43
```
2021-11-08 16:15:44 +08:00
YAMAMOTO TakashiandGitHub 68d72c300f Fix a wrong alignment assumption when emitting aot file (#792)
The size used to apply "size = align_uint(size, 4)" may be different
when calculating total size (in get_object_data_sections_size) and
emitting actual data (in aot_emit_object_data_section_info) for the
object data section.

This patch fixes the "Error: emit object data section info failed".
2021-10-19 17:11:24 +08:00
YAMAMOTO TakashiandGitHub 808ad2e4f1 Add __umodsi3 to target symbol map in aot_reloc_arm.c (#793)
The symbol _umodsi3 may be used by AOT file generated with "wamrc --target=armv7".
2021-10-19 17:04:09 +08:00
YAMAMOTO TakashiandGitHub ea835db54c Enable wamr-test-suites on MacOS (#740) 2021-09-10 10:11:46 +08:00
YAMAMOTO TakashiandGitHub 336abc2b27 Fix a build on alpine, whose libc is musl (#726)
Change __syscall_slong_t to __SYSCALL_SLONG_TYPE, and use it when macro __SYSCALL_SLONG_TYPE is defined.
2021-09-07 10:03:54 +08:00
YAMAMOTO TakashiandGitHub 79f163d08b Appease some UBSan complaints (#720) 2021-09-04 10:09:30 +08:00
YAMAMOTO TakashiandGitHub ee24d78483 Fix Debug build error with clang-11 on linux (#714)
Remove bound-strict flag from -fno-sanitize list in Linux Debug build with clang as clang-11 doesn't have bounds-strict
2021-09-01 18:36:27 +08:00
YAMAMOTO TakashiandGitHub e80715f352 lib-pthread: Fix pthread_create callback arg issue (#701)
The last argument arg of pthread_create passed from wasm app is opaque
for the library and host, it should be returned back to the wasm app without
any interpretation. There is no point to translate it to a native address.
Actually it harms because the validation seems broken.
2021-08-19 18:21:56 +08:00
YAMAMOTO TakashiandGitHub ef14ace027 small doc fixes (#700)
doc/embed_wamr.md: WASMModuleInstanceCommon -> wasm_module_inst_t
wamr-sdk/README.md: fix a link
2021-08-19 14:44:14 +08:00
YAMAMOTO TakashiandGitHub 15dd651539 Fix os_cond_timedwait and other issues for NuttX sim/macOS (#562) 2021-05-31 09:56:47 +08:00
YAMAMOTO TakashiandGitHub 2dd3875fd9 nuttx: Fix build for sim on macOS (#423) 2020-10-13 14:14:55 +08:00
YAMAMOTO TakashiandGitHub f7903caa65 wasm_loader_ctx_init: Don't use false as a pointer (#422) 2020-10-13 14:13:30 +08:00