Commit Graph

29 Commits

Author SHA1 Message Date
rpkak 208a74a5c5 libc: remove duplicates of some functions
mingw,musl,wasi-libc: remove c files, that only provide functions already included in zigc

mingw: remove c files, that only provide functions, which are in ucrt

mingw: do not include mingw files/zigc functions on targets on which they in ucrt
2026-04-03 15:26:09 +02:00
mihael 159568a05a Reimplement coshf in libzigc
The function basically calls the Zig std's implementation.

The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=coshf -fqemu -fwasmtime --summary line
Build Summary: 553/553 steps succeeded
```
2026-03-10 00:42:32 +01:00
mihael 1f92162875 Reimplement cosh in libzigc
The function basically calls the Zig std's implementation.
The changes were tested by running:

```
$ ./build/stage3/bin/zig build -p stage4 -Denable-llvm -Dno-lib

$ stage4/bin/zig build test-libc -Dlibc-test-path=<LIBC-TEST-PATH> -Dtest-filter=cosh -fqemu -fwasmtime --summary line
Build Summary: 921/921 steps succeeded
```
2026-03-10 00:42:14 +01:00
Andrew Kelley f5d5dbd166 wasi libc: remove malloc defines 2026-02-12 13:14:51 -08:00
Andrew Kelley 6744160211 zig libc: implement malloc 2026-02-12 13:14:51 -08:00
Andrew Kelley b600b6e5e0 std.posix: remove close function 2026-02-11 23:37:31 +01:00
GasInfinity 4f652fb4e3 feat(libzigc): use common implementations for sys/utsname.h
* and remove their musl/wasi implementation
2026-01-21 00:06:42 +01:00
GasInfinity f0649dd978 feat(libzigc): use common implementations for strings.h and string.h
* forwards all functions to their equivalent `std`
* removes their musl, wasi-libc and mingw implementations
2026-01-17 22:37:29 +01:00
Carl Åstholm 6376103b23 wasi-libc: De-deduplicate erroneously removed headers
05d8b565ad deduplicated wasi-libc headers
that are identical to upstream musl, but because some public headers
match the same `#include <>` patterns as private headers, this resulted
in unmodified upstream musl headers sometimes getting prioritized when
compiling wasi-libc, resulting in incorrect definitions. For example,
`UTIME_OMIT` is supposed to be -2 on WASI, but became 0x3ffffffe.

The restored headers were sourced from
<https://github.com/WebAssembly/wasi-libc/tree/c89896107d7b57aef69dcadede47409ee4f702ee>
which is the same revision as the most recent wasi-libc sync
07cc32b004.
2026-01-12 22:33:29 +01:00
rpkak aa7dac9739 libc: remove fmin/fmax implementations 2026-01-10 00:09:54 +01:00
Yefeng Li aae5560712 Remove memcmp and memset from bundled musl and wasi 2025-08-27 03:35:18 +02:00
Alex Rønne Petersen 07cc32b004 wasi-libc: update to c89896107d7b57aef69dcadede47409ee4f702ee 2025-08-20 19:18:11 +02:00
Alex Rønne Petersen 2174014349 wasi-libc: Remove pointless alltypes.h.in file. 2025-04-11 02:28:35 +02:00
Alex Rønne Petersen 05d8b565ad wasi-libc: Deduplicate sources and headers with regards to upstream musl.
Unfortunately some duplicate files must remain in lib/libc/wasi/libc-top-half
because they include internal headers *in the same directory* which have edits
relative to upstream musl. Because C is an amazing language, there is no way to
make it so that e.g. upstream musl's src/stdio/fputc.c includes wasi-libc's
src/stdio/putc.h instead of the upstream putc.h. The preprocessor always
searches the current directory first for quote includes.

Anyway, this still takes us from 2.9M to 1.4M for the combination of
lib/libc/wasi and lib/libc/include/wasm-wasi-musl, so I still call it a win.
2025-02-21 09:23:50 +01:00
Frank Denis e60072635e Add libdl shims from wasi-libc 2025-01-29 12:48:56 +01:00
Frank Denis 8a8da49b52 Re-add lazy preopen changes 2025-01-29 11:54:08 +01:00
Frank Denis 3f4c43b0aa Update wasi-libc to d03829489904d38c624f6de9983190f1e5e7c9c5 2025-01-29 11:54:02 +01:00
Andrew Kelley b07958e6b7 delete asm files from wasi libc
why the hell are there asm files in wasi libc to begin with?
2025-01-17 12:34:15 -08:00
Andrew Kelley e6dc85f1b4 remove memcpy and memmove from bundled libcs
These are provided instead by compiler_rt.

Part of #2879
2025-01-17 12:34:15 -08:00
Frank Denis dcc1b4fd15 Update wasi-libc to 3189cd1ceec8771e8f27faab58ad05d4d6c369ef (#15817)
Also remove all the wasi-libc files we used to ship, but never compile.

The latest wasi-libc HEAD has an extra commit (a6f871343313220b76009827ed0153586361c0d5), which makes preopen initialization lazy.

Unfortunately, that breaks quite a lot of things on our end. Applications now need to explicitly call __wasilibc_populate_preopens() everywhere when the libc is linked. That can wait after 0.11.
2023-05-23 22:12:53 +02:00
Frank Denis cbbf8c8a2d wasi-libc: use __heap_end if available (#14273)
The symbol was introduced in LLD 15.0.7, as a way to know how
much memory can be allocated:

https://github.com/llvm/llvm-project/commit/1095870e8ceddc5371f446f4e7c3473f89a461cd
https://github.com/WebAssembly/wasi-libc/pull/377
2023-01-12 13:48:14 +00:00
Frank Denis 24d8d12caf Update wasi-libc to a1c7c2c7a4b2813c6f67bd2ef6e0f430d31cebad
Some notable changes:
- `ENOENT` is returned instead of `ENOTCAPABLE` when a path has not
be pre-opened (https://github.com/WebAssembly/wasi-libc/pull/370)
- `fd_readdir()`: some implementations may not set the inode number,
so an additional call to `fstatat()` is now done in order to get it
when that happens.
2023-01-10 17:14:27 -05:00
Frank Denis 817cf6a82e Update wasi-libc to 8b7148f69ae241a2749b3defe4606da8143b72e0 (#13793) 2022-12-06 22:48:35 +00:00
Frank Denis da9c530d99 Update wasi-libc to a00bf321eeeca836ee2a0d2d25aeb8524107b8cc (#13626)
* Update wasi-libc to a00bf321eeeca836ee2a0d2d25aeb8524107b8cc

It includes a port of emscripten's allocator that performs
performs much better than the old one.

Most importantly, it includes the prerequisites to later add
support for POSIX threads.
2022-11-28 19:58:03 +01:00
Frank Denis 8c63037695 Update the WASI libc
Update our copy of wasi-libc up to the commit
30094b6ed05f19cee102115215863d185f2db4f0 from the upstream repository.
2022-06-14 23:20:39 +02:00
Takeshi Yoneda b9e896d7b0 wasi-libc: remove crt1.o as it's not WASI ABI compatible
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2021-07-11 00:06:47 +02:00
Jakub Konka f291b8b9bc cc,wasi: remove unused headers and sources 2021-05-20 16:54:00 +02:00
Jakub Konka 60d8779eae cc,wasi: add source file paths to wasi_libc.zig 2021-05-20 16:54:00 +02:00
Jakub Konka 782cfedaf6 cc,wasi: add wasi-libc source 2021-05-20 16:54:00 +02:00