Since the top-level CMakelists.txt is appending `-fvisibility=hidden` to
the compile options, no public symbols are exported by default. This
forbids users from linking against the shared library.
Using `gcc/clang` attributes [1], it is possible to override the definition
for `WASM_RUNTIME_API_EXTERN` so that only required symbols are
correctly exported.
[1]: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
Filesystem paths can be mapped from the host path to a guest path using
the format `<guest-path>::<host-path>`.
Previously `strtok` was used to find the `::` delimiter. Unfortunately
`strtok` processes each delimiter character individually. This meant
that the code was ~equivalent to `strtok(mapping_copy, ":")` which
breaks with Windows-style paths (E.g. `C:\my_path\`).
To fix this `strstr` is used to search for the exact delimiter.
`module_inst->table_count = module->import_table_count + module->table_count`,
using it as an index will go through `module->import_tables` and `module->tables`,
but aot init data is only available for non-import tables.
While resolving linked globals in multi-module mode, WAMR tries to copy
the linked global's initial value into the destination global in the
current module. However, a bug in the implementation causes the copy to
be done from the InitializerExpression struct, not from its WASMValue
field.
This did not come up in WAMR's spec test runner because those are built
with WASM_ENABLE_SPEC_TEST, which means these globals are resolved as
builtins, not linked globals, which goes through a different (presumably
not faulty) path.
This commit refactors the AOT loader in `aot_loader.c` to support compatible
versions of the AOT_CURRENT_VERSION constant. Previously, the loader only
accepted the exact AOT_CURRENT_VERSION value, but now it also accepts
version 3. This change ensures that the runtime can load modules AoT-compiled
with different versions of wamrc as long as they have compatible
AOT_CURRENT_VERSION values.
Related to #3880.
When checking for integer overflow, you may often write tests like p + i < p.
This works fine if p and i are unsigned integers, since any overflow in the
addition will cause the value to simply "wrap around." However, using this
pattern when p is a pointer is problematic because pointer overflow has
undefined behavior according to the C and C++ standards. If the addition
overflows and has an undefined result, the comparison will likewise be
undefined; it may produce an unintended result, or may be deleted entirely
by an optimizing compiler.
* Bump AOT_CURRENT_VERSION for WAMR 2.x (gc, memory64)
Maybe it's too late because we have already made a few releases
since then.
But this might still help users who haven't upgraded to WAMR 2.x yet.
Also, for the purpose of the versioning, it's safer to bump
needlessly than missing necessary bumps.
Fixes https://github.com/bytecodealliance/wasm-micro-runtime/issues/3837
* test-tools/aot-analyzer/include/config.h: bump AOT_CURRENT_VERSION
Previously, the loader would check the name of a new export against all
existing exports, leading to a quadratic running time.
This change makes the loader parse the entire export section. The
exports are then sorted by name, then adjacent exports are checked for
uniqueness.
- For Windows, llvm libs need to cache more directories, so use a multi-line
environment variable for paths
- Remove conditionally build directories `win32build`, just use `build` for all platform
- Add Windows wamrc and iwasm(disable lib pthread semaphore and fast jit for now)
build in release CI
- Clear some compile warnings
- Fix some typos
- Fix llvm LICENSE link error
- Remove unused aot file and binarydump bin
- Add checks when loading AOT exports
The default iwasm building in Windows MSVC enables libc-uvwasi because
libc-wasi isn't supported at the beginning. Since libc-wasi had been refactored
and is supported in Windows msys2 building, and libc-wasi supports more
functionalities(e.g. sockets) than libc-uvwasi, this PR fixes some issues to
enable libc-wasi in windows MSVC buidlings.
Add table64 extension(in Memory64 proposal) support in classic-interp
and AOT running modes, currently still use uint32 to represent table's
initial and maximum size to keep AOT ABI unchanged.
Currently, the open-source builds of wamrc set WASM_ENABLE_DUMP_CALL_STACK,
which causes these two fields to be emitted. They are required by aot_emit_exception.c.
Internally at Google, we don't enable call stack dumps, so we've been using the
attached patch to make sure the fields are emitted anyway.