This gets ready for switching to the standard vars, which sadly were
already mis-initialized in this environment so we have to be extra
careful to override them.
The WASI signal constants and proc_raise function were removed in the
latest [ephemeral], which had been scheduled to be in the next snapshot,
however WASI itself is now transitioning away from the snapshot system.
WASI libc will also be transitioning to updated wit specs once they're
ready, however until that time, we can make the simple change of
removing these signal constants to avoid confusion.
Fixes#271.
Fixes#272.
[ephemeral]: https://github.com/WebAssembly/WASI/tree/main/phases/ephemeral/witx
If using a custom toolchain not on the path, explicitly invoking
ccache/sccache is required (also easier to debug that the right compiler
is being invoked). Fixes#253.
Add a build flag MALLOC_IMPL that can be set to dlmalloc or none
(defaulting to dlmalloc) which controls the malloc implementation to
use. The dlmalloc option is the same as before, but selecting none
removes dlmalloc from the libc build.
This flag replaces the BUILD_DLMALLOC flag, which never worked and thus
can be removed without breaking any builds. By switching to MALLOC_IMPL,
there is a clear path towards a different heap implementation, such as
mimalloc.
Add a `__wasilibc_deinit_environ` function which clears the current
environment variable state to the state where next time the environment
variable functions are called, they'll reinitialize the environment.
And add a `__wasilibc_maybe_reinitialize_environ_eagerly` function to
reinitialize the environment variable state if `environ` or `_environ`
are needed.
These functions are needed by wizer to be able to suspend and resume
a program and have it read new environment variables from the host
environment; see bytecodealliance/wizer#8 for background.
Upcoming WASI snapshots omit the `PROCESS_CPUTIME` clock, since WASI has
no inherent concept of processes, and since implementations which don't
use a process for each instance don't have a way to implement it
efficiently.
However, `clock`, `times`, and `getrusage` are useful functions, so
provide optional emulated version of them, using the `MONOTONIC` clock.
This means these implementations will measure not just the program's
own CPU time, but also time spent suspended while other programs are
running.
Due to this difference in behavior, put these implementations behind
a flag. Users must pass `-D_WASI_EMULATED_PROCESS_CLOCK` and link with
`-lwasi-emulated-process-clocks` to enable them.
* Update to the next version of the `witx` crate
* Generate adapter functions instead of simply a header file to have a
place where adapter code can go.
* Implement adapters in terms of the instructions that the `witx` crate
tells us about.
* Update the interface of functions to what `witx` expects, notably
string arguments are now only taken as `char*` and `strlen` happens in
the adapter function.
* Update defined/predefined/undefined symbol lists for types that have
been updated.
Some precise generated code has changed but the actual APIs should all
be the same except for the change to not take the length of the string
in the raw WASI call, since idiomatically C doesn't pass the length of
strings around.
Eventually it's expected that the shim functions, while sometimes not
necessary today, will implement more checks and more conversions as
necessary for new APIs.
* Actually update witx submodule
* Comment how to regenerate files
* Tweak name of actual function imports
Make it a bit clearer that they're the ones that we're importing and
calling.
* Update submodule to point to WebAssembly
AT_FDCWD is a special constant in POSIX that can be passed to *at
functions to indicate the current working directory. Since the
current working directory is emulated in wasi libc, add emulated
AT_FDCWD support as well.
Fixes#42.
We've already started removing this; this just removes all remaining
ones under the libc-bottom-half directory.
These markers were originally intended to help track upstream changes,
however in practice they created a lot of clutter and weren't that
helpful. And now, upstream cloudlibc is no longer active.
CFLAGS now get initialized with the provided value for WASM_CFLAGS, or
its default.
This seems to be the intended use case of having `WASM_CFLAGS ?=` at the
top of the Makefile. Otherwise, if WASM_CFLAGS is set on the command
line, it overrides all CFLAGS and for example `--sysroot` is not added,
rendering the build invalid unless it is supplied on the make command
line.
In the musl 1.2.1 update, I made a change to disable the new code in
sinh for handling directed rounding modes, but I only incompletely
disabled it. This led to `sinh(-inf)` computing `inf` instead of `-inf`,
detected in [wasi-libc-test]. This patch fixes it.
[wasi-libc-test]: https://github.com/CraneStation/wasi-libc-test/tree/master/libc-test
See the WHATSNEW file for details. WASI libc currently uses a separate
malloc, so the new mallocng is not currently used.
This includes a few new custom changes to disable code for handling
directed rounding modes. Wasm doesn't have directed rounding modes,
so disabling this code size saves code size, something the WASI libc
project cares about!