Skip to content

Dev/zephyr file socket #4377

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

Open
wants to merge 185 commits into
base: dev/zephyr_file_socket
Choose a base branch
from

Conversation

srberard
Copy link
Contributor

This is still a work in progress, but committing now to make the code available for others who might want to review, test, or build on it while it's still being developed.

Fixes include the following (Zephyr target):

  • Improved Socket support
  • Fixes to stdout/console output
  • Fixes for fstat, fstatat, and unlink
  • Code changes to fix numerous build warnings.

This branch still needs to be updated to the latest trunk and validation on non-Zephyr platforms.

srberard and others added 30 commits December 3, 2024 13:36
Fixed issues in os_renameat

Signed-off-by: Stephen Berard <stephen.berard@outlook.com>
set alignment 4 when loading multi return value for all call opcodes
…liance#3957)

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
…ealliance#3960)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.6 to 3.27.9.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](github/codeql-action@v3.27.6...v3.27.9)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
At least fast-jit seems to require a bit new C++ standard.
C++17 was chosen to match product-mini/platforms/darwin.
- Increase input seed size for wasm-tools to generate larger WebAssembly modules
- Add instantiation in wasm mutator fuzz tests
By default, the project() CMake command defaults to C and C++. [1]
Therefore, CMake might perform tests for both C and C++ compilers as
part of the configuration phase.

However, this has the consequence of the configuration phase to fail if
the system does not have a C++ toolchain installed, even if C++ is not
really used by the top-level project under the default settings.

Some configurations might still require a C++ toolchain, so
enable_language is selectively called under such circumstances.

[1]: https://cmake.org/cmake/help/latest/command/project.html
…lliance#3973)

This fixes link errors seen on my environment.
(macOS 15.2, x86-64, Xcode 16.2)

Tested as:
```
mkdir b
cd b
cmake -D WAMR_BUILD_JIT=1 -D LLVM_DIR=/usr/local/opt/llvm@19/lib/cmake/llvm ..
make
```
…#3967)

For boundary checking, WAMR calls `pthread_attr_np`, which is
unfortunately quite slow on Linux when not called on the main thread
(see bytecodealliance#3966
for discussion).

This change moves the cost of stack bounds checking earlier in the
wasm_exec_env creation process. The idea is that it's perhaps better to
pay the price when creating the execution environment rather than in the
first function call.

The original code is left in place inside
`call_wasm_with_hw_bound_check` in case the `wasm_exec_env` is created
via `wasm_runtime_spawn_exec_env`.
…ealliance#3982)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.9 to 3.28.0.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Commits](github/codeql-action@v3.27.9...v3.28.0)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…dealliance#3981)

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.4.3 to 4.5.0.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v4.4.3...v4.5.0)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
…ce#3983)

Save memory if the file buffer is always exist before exit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Break aot_create_comp_data into small functions
Improve error message in the scenario where the runtime was built
with ref types disabled but the module uses reference types feature.
)

* Update CMakeLists.txt of fuzzing

- enable software bound-check
- enable wasi
- disable libc builtin and multiple modules

* Fix off-by-one error in result offset calculation for function calls
…ytecodealliance#3999)

* check whether table has funcref elem in call_indirect
* check whether table has funcref elem in call_indirect when gc is enabled
…ets (bytecodealliance#4011)

One more corner case: if the `frame_offset` increases and becomes equal to
the `frame_offset_boundary` after the last assignment within the for loop.
…oposals (bytecodealliance#3972)

Add documentation regarding security issues and the status of Wasm proposals.
…odealliance#4008)

- Enable shrunk memory by default and add related configurations
- Improve error messages for memory access alignment checks
- Add documentation for WAMR shrunk memory build option
- Update NuttX workflow to disable shrunk memory build option
TianlongLiang and others added 17 commits April 22, 2025 12:08
…v128

Add missing V128 handling in WASM_OP_BR, reported in bytecodealliance#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
…#4220)

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)
…ance#4121)

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'.
…ytecodealliance#4227)

- set default value of WAMR_BUILD_REF_TYPES to 1 in CMakeLists.txt
Addressed numerous of build warnings on Zephyr

Signed-off-by: Stephen Berard <stephen.berard@outlook.com>
Signed-off-by: Stephen Berard <stephen.berard@outlook.com>
Signed-off-by: Stephen Berard <stephen.berard@outlook.com>
@lum1n0us
Copy link
Collaborator

@banana-sun Please conduct a test with this PR, thanks.

@lum1n0us
Copy link
Collaborator

@srberard There are so many commits that make reviews difficult. Do you think a rebase (targeting main) for bytecodealliance:dev/zephyr_file_socket would make it easier?

@srberard
Copy link
Contributor Author

@srberard There are so many commits that make reviews difficult. Do you think a rebase (targeting main) for bytecodealliance:dev/zephyr_file_socket would make it easier?

I did rebase this a few weeks back off main. I can do that again, but I don't think that will reduce the commit list.

@lum1n0us lum1n0us mentioned this pull request Jun 18, 2025
5 tasks
Partial implementation — just avoids a hard fault.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.