- Jun 28, 2025
-
-
Cheng Shao authored
This commit allows -flto=thin to be added to the global CFLAGS, though we don't enable it by default for the time being.
-
Cheng Shao authored
-
Cheng Shao authored
This patch enables certain wasm feature flags and optimizations that we approve of.
-
Cheng Shao authored
-
Cheng Shao authored
-
Cheng Shao authored
-
Cheng Shao authored
-
Cheng Shao authored
-
Cheng Shao authored
-
Cheng Shao authored
This reverts commit 48eb92c1.
-
- Jun 25, 2025
-
-
Yuta Saito authored
Update @bjorn3/browser_wasi_shim to version 0.4.2. This release includes a limited polyfill for `poll_oneoff`, which is necessary for the `pthread_cond` test to pass in the browser. https://github.com/bjorn3/browser_wasi_shim/pull/88
-
- Jun 20, 2025
-
-
Yuta Saito authored
The `pthread_cond` test uses `nanosleep` which eventually calls `poll_oneoff` but `@bjorn3/browser_wasi_shim` does not implement it. So we skip the test for now, but we will revisit it later once https://github.com/bjorn3/browser_wasi_shim/pull/88 is merged.
-
- Jun 19, 2025
-
-
Yuta Saito authored
We are heavily using wasi-libc + wasip1-threads on browsers. Since wasi-libc uses `memory.atomic.wait32` to implement futex, and the usage of `memory.atomic.wait32` on the main thread is prohibited on browsers, we currently need to write code carefully not to reach the instruction. Emscripten addresses this limitation by [employing a busy-wait on the main thread](https://github.com/emscripten-core/emscripten/blob/058a9fff/system/lib/pthread/emscripten_futex_wait.c#L111-L150) as a workaround. Rust has [always employs busywait regardless of the current thread is main](https://github.com/rust-lang/rust/blob/a47555110cf09b3ed59811d9b02235443e76a595/library/std/src/sys/alloc/wasm.rs#L75-L144). This approach, while effective for browsers, introduces unnecessary overhead in environments where memory.atomic.wait32 is permitted. This change provides a similar solution by introducing an opt-in busy-wait mode for futexes. By making this an optional feature, we avoid imposing the overhead of busy-waiting in non-browser environments while ensuring compatibility with browser-based restrictions. ```c #include <wasi/libc-busywait.h> /// Enable busywait in futex on current thread. void __wasilibc_enable_futex_busywait_on_current_thread(void); ``` This change slightly adds some runtime overheads in futex to check if we should use busywait, but it can be optimized away as long as `__wasilibc_enable_futex_busywait_on_current_thread` is not used by user program and LTO is enabled.
-
Henri Nurmi authored
This is a follow-up PR for #524 by implementing the following features: - Embeds a minimal network services database with 17 common protocols, suggested by @badeend. The database array is a weak symbol allowing applications to override the default database at link time. - Updates `getaddrinfo` to resolve named services in the address info. For example `getaddrinfo("google.com", "https", NULL, &res);` - Implements the `getservbyname` and `getservbyport` functions. These functions are implemented using a static variable (`global_serv`), which holds the returned service entry. This approach is acceptable because these functions [are defined as not being thread-safe](https://man.archlinux.org/man/getservbyname.3.en). ~~Additionally, this PR introduces an optional, more comprehensive services database (`sockets_full_services_db.c`), based on Debian Bookworm's `/etc/services` file (320 entries). To use this database, link with the `-lc-full-services-db` flag.~~
-
Alex Crichton authored
There are a number of changes in this commit aimed at addressing #587 and making it easier to test #586 in CI. Notable changes here are: * The matrix of what to test is much different from before. One matrix entry now builds just one target and optionally tests that target. * The CI matrix ensures that wasi-libc builds on a variety of platforms, e.g. Windows/macOS/Linux as well as Linux aarch64. * The CI matrix has one entry for building with an older version of LLVM. This version was bumped from LLVM to LLVM 11 since LLVM is installed through `apt-get`, not through downloads any more. * On Linux LLVM/Clang are downloaded through `apt-get` instead of from llvm-project binaries to avoid dealing with `libtinfo5` and dependencies. * The CI matrix has a test job per-target. This can be expanded/shrunk as necessary but currently everything is tested with LLVM 16 (as before) and only on Linux (also as before). The test run is seqeunced to happen after the build of libc itself. * The CI matrix has split out V8 headless tests into their own job to avoid running multiple suites of tests in a single job. * Installation of LLVM is refactored to a separate action to reduce the noise in `main.yml`. * Setting `TARGET_TRIPLE` can now be done through environment variables as opposed to only through arguments to `make`. * Handling of `BULITINS_LIB` has improved. Previously the build target for `libc_so` would modify the compiler's resource directory and this is updated to use a custom directory in `OBJDIR`. * Arranging compiler-rt for tests is now done with `-resource-dir` instead of copying the directory into the system compiler's location. Overall it's the intention that no amount of testing is lost in this PR. The goal is to expand things out in such a way that it's much easier to add one-off tests of wasi-libc in various build configurations and such. The theory is that this is as "simple" as adding a new matrix entry, copied from previous ones, customized with various variables and environment variables to affect the build (e.g. `CFLAGS`). Closes #587
-
- Jun 03, 2025
-
-
Dan Gohman authored
See the WHATSNEW file for details. As described on the [musl homepage](https://musl.libc.org/), this also includes the two patches ([1](https://www.openwall.com/lists/musl/2025/02/13/1/1), [2](https://www.openwall.com/lists/musl/2025/02/13/1/2)) fixing CVE-2025-26519. This fixes #577.
-
- Jun 02, 2025
-
-
Lukas authored
clang introduced a new warning (following gcc) for string initialization to char arrays that do not fit the null terminal. Introduced here: https://github.com/llvm/llvm-project/pull/137829 Included in LLVM version [LLVM 20.1.4](https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.4)+ More detail: -Wunterminated-string-initialization warns for c string literals that are written to a buffer too small to include a null terminator. This warning is also included in -Wextra which is enabled for wasi-libc and fails compilation due to -Werror. Possible fixes: 1. deactivate the warning 2. add `__attribute__ ((nonstring))` to the three occurrences where this is a problem. Chosen solution: 1. Since the attribute is not available on older clang versions, it would trigger another warning there. (included a small formatting change in the commit - pls ignore)
-
- May 13, 2025
-
-
YAMAMOTO Takashi authored
My motivation is to allow -mcpu=lime1 build with LLVM 20. Note that extended-const is a part of lime1. https://github.com/WebAssembly/tool-conventions/blob/main/Lime.md#lime1 cf. https://github.com/WebAssembly/wasi-sdk/pull/527
-
- May 09, 2025
-
-
Yuta Saito authored
This change makes it so that the timestamps of installed header files are only updated when the contents of the header files change. This change is beneficial for incremental builds of projects depending on wasi-libc. For example, the Swift project builds wasi-libc as part of its build process, and this change reduces the number of build products in the Swift build that are unnecessarily rebuilt. This is a 2nd attempt of https://github.com/WebAssembly/wasi-libc/pull/530 but much simpler thanks to @abrown 's build work
-
- Feb 04, 2025
-
-
mcbarton authored
This PR updates ADAPTER_URL to reference the latest release version (versions 29.0.1)
-
mcbarton authored
This PR updates WASM_TOOLS_URL to reference the latest released version (version 1.224.0)
-
mcbarton authored
This PR updates WASMTIME_URL to reference the latest release version (29.0.1)
-
mcbarton authored
This PR updates LIBRT_URL to reference the latest release version (wasi-sdk-25).
- Feb 03, 2025
-
-
Yuta Saito authored
This commit adds a browser test harness to run the tests in the browser. ## Motivation We are heavily using wasi-libc on browsers but we don't have any test for the case in wasi-libc. In theory, there should be no behavioral difference between wasmtime and browsers (as long as WASI implementations are correct) but browsers have their own limitations in their Wasm engines. For example, memory.atomic.wait32 is not permitted on the main thread. We are working on adding some mitigation for such browser-specific issues (https://github.com/WebAssembly/wasi-libc/pull/562) and this test harness will help to validate the fix.
-
mcbarton authored
-
mcbarton authored
-
- Feb 02, 2025
-
-
mcbarton authored
Rather than using Macos-latest this makes the ci used a pinned version of Macos (set to the latest version available). This is so if you happen to have an issue with the MacOS build you know exactly which version of MacOS it is running, rather than having to dig into the ci, or Github runner documentation.
-
mcbarton authored
Rather than using Windows-latest this PR updates the ci to use a pinned version of Windows (set to the latest version available). This is so if you happen to have an issue with the Windows build you know exactly which version of Windows it is running, rather than having to dig into the ci, or Github runner documentation.
-
- Jan 28, 2025
-
- Jan 20, 2025
-
-
Yuta Saito authored
This change enables the pthread-related tests in the libc-test suite. The tests are enabled only for the `wasm32-wasip1-threads` target, which is the only target that supports threads at the moment. The following pthread tests are still disabled: - pthread_cancel-points.c - pthread_cancel.c - pthread_robust.c This is a preparative change for https://github.com/swiftwasm/swift/issues/5598
-
Yuta Saito authored
Follow-up to 2b853ff0 The wrong shebang caused `&>` to be interpreted as a background job
-
Yuta Saito authored
GitHub Actions is migrating ubuntu-latest to Ubuntu 24.04, which no longer provides the libtinfo5 package. Since older LLVM versions depend on libtinfo5 and do not offer pre-built binaries for recent Ubuntu versions, we explicitly specify ubuntu-22.04 in the workflow to maintain compatibility.
-
- Dec 09, 2024
-
-
Andrew Brown authored
This change represents a rather large re-design in how `wasi-libc` builds and runs its tests. Initially, #346 retrieved the `libc-test` repository and built a subset of those tests to give us some amount of test coverage. Later, because there was no way to add custom C tests, #522 added a `smoke` directory which allowed this. But (a) each of these test suites was built and run separately and (b) it was unclear how to add more tests flexibly--some tests should only run on `*p2` targets or `*-threads` targets, e.g. This change reworks all of this so that all tests are built the same way, in the same place. For downloaded tests like those from `libc-test`, I chose to add "stub tests" that `#include` the original version. This not only keeps all enabled tests in one place, it also allows us to add "directives," C comments that the `Makefile` uses to filter out tests for certain targets or add special compile, link or run flags. These rudimentary scripts, along with other Bash logic I moved out of the Makefile now live in the `scripts` directory. Finally, all of this is explained more clearly in an updated `README.md`. The hope with documenting this a bit better is that it would be easier for drive-by contributors to be able to either dump in new C tests for regressions they may find or enable more libc-tests. As of my current count, we only enable 40/75 of libc-test's functional tests, 0/228 math tests, 0/69 regression tests, and 0/79 API tests. Though many of these may not apply to WASI programs, it would be nice to explore how many more of these tests can be enabled to increase wasi-libc's test coverage. This change should explain how to do that and, with directives, make it possible to condition how the tests compile and run.
- Dec 04, 2024
-
-
Andrew Brown authored
This change is not meant to change any functionality, only move some Bash-specific logic out of the `Makefile` into its own script: `install-include-headers.sh`. This reduces the perceived complexity of the `Makefile` but the complexity is still there, tucked away in this script. This script also has the advantage that it can be run separately if needed. This commit comes after a few different attempts at building up `Makefile` lists of headers to copy over along with the various locations they must be copied from. It is certainly possible to do this, but due to how we need to remove some headers from the list, it ends up being easier to just `cp` and then `rm`, which this script retains.
-
- Nov 27, 2024
-
-
Andrew Brown authored
This change is an effort to move all dependencies of the phony `bindings` target into one place, for clarity.
-
Andrew Brown authored
This adds a `.stamp` file to the process of copying over the `crt` files to the sysroot directory to avoid re-copying on each `make` invocation.
-
- Nov 20, 2024
-
-
Andrew Brown authored
This adds a `.stamp` file to the build directory that tracks when all headers have been copied over to the sysroot `include` directory. Previously, the `include_dirs` target was phony, which `make` will run every time, regardless of whether it is needed. This was part of the problem with all of libc being rebuilt at each `make` invocation.
-
Andrew Brown authored
Previously, these were rebuilt each time as a part of the phone `dummy_libs` target. This change only rebuilds them if they don't exist.
-