wasi-libc updates are on hold in favor of moving implementation code to libzigc #30977

Closed
opened 2026-01-24 01:11:21 +01:00 by alexrp · 1 comment
Owner

Migrated from: https://github.com/ziglang/zig/issues/24923

https://github.com/ziglang/zig/pull/24889 updated our import of wasi-libc such that it's now on musl 1.2.5, matching our import of upstream musl. This allowed deleting a bit more duplicate code that I didn't in https://github.com/ziglang/zig/pull/22905.

However, we're not particularly happy with how the wasi-libc project is structured and developed. Going forward, we will not be importing new versions of wasi-libc; instead, the implementation code should be migrated to libzigc as Zig code. The goal here is that we only provide the upstream wasi-libc headers, although there may even be quite a bit of room for improvement on that front.

Here's how much implementation code we currently carry from wasi-libc:

❯ cloc lib/libc/wasi
     356 text files.
     349 unique files.
       7 files ignored.

github.com/AlDanial/cloc v 2.04  T=0.06 s (6132.7 files/s, 543509.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
C                              239           2416           2607          16678
C/C++ Header                   110           1448            253           7528
-------------------------------------------------------------------------------
SUM:                           349           3864           2860          24206
-------------------------------------------------------------------------------

However, I would note that a significant portion of this is still duplicate musl code, e.g. because a file has a small section of __wasilibc_unmodified_upstream code, or because some files are duplicated due to C preprocessor idiosyncrasies. I think once you trim the fluff, this is actually a fairly surmountable sub-project.

Related:

Migrated from: https://github.com/ziglang/zig/issues/24923 https://github.com/ziglang/zig/pull/24889 updated our import of wasi-libc such that it's now on musl 1.2.5, matching our import of upstream musl. This allowed deleting a bit more duplicate code that I didn't in https://github.com/ziglang/zig/pull/22905. However, we're not particularly happy with how the wasi-libc project is structured and developed. Going forward, we will not be importing new versions of wasi-libc; instead, the implementation code should be migrated to libzigc as Zig code. The goal here is that we only provide the upstream wasi-libc headers, although there may even be quite a bit of room for improvement on that front. Here's how much implementation code we currently carry from wasi-libc: ``` ❯ cloc lib/libc/wasi 356 text files. 349 unique files. 7 files ignored. github.com/AlDanial/cloc v 2.04 T=0.06 s (6132.7 files/s, 543509.9 lines/s) ------------------------------------------------------------------------------- Language files blank comment code ------------------------------------------------------------------------------- C 239 2416 2607 16678 C/C++ Header 110 1448 253 7528 ------------------------------------------------------------------------------- SUM: 349 3864 2860 24206 ------------------------------------------------------------------------------- ``` However, I would note that a significant portion of this is still duplicate musl code, e.g. because a file has a small section of `__wasilibc_unmodified_upstream` code, or because some files are duplicated due to C preprocessor idiosyncrasies. I think once you trim the fluff, this is actually a fairly surmountable sub-project. Related: * https://codeberg.org/ziglang/zig/issues/30978 * https://codeberg.org/ziglang/zig/issues/30936
alexrp added this to the Post-1.0 milestone 2026-01-24 01:11:21 +01:00
Author
Owner

Note that, for ABI purposes, our current target is wasi-libc commit c89896107d7b57aef69dcadede47409ee4f702ee.

Note that, for ABI purposes, our current target is wasi-libc commit `c89896107d7b57aef69dcadede47409ee4f702ee`.
alexrp referenced this issue from a commit 2026-08-24 23:00:49 +02:00
alexrp referenced this issue from a commit 2026-08-25 13:35:43 +02:00
alexrp referenced this issue from a commit 2026-08-25 15:50:27 +02:00
alexrp referenced this issue from a commit 2026-09-17 22:39:59 +02:00
alexrp referenced this issue from a commit 2026-09-28 17:50:24 +02:00
alexrp referenced this issue from a commit 2026-09-29 02:14:19 +02:00
alexrp referenced this issue from a commit 2026-09-29 13:25:33 +02:00
alexrp referenced this issue from a commit 2026-10-03 19:38:16 +02:00
alexrp referenced this issue from a commit 2026-10-04 05:05:46 +02:00
alexrp referenced this issue from a commit 2026-10-04 18:23:43 +02:00
alexrp removed this from the Post-1.0 milestone 2026-10-04 18:25:10 +02:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ziglang/zig#30977
No description provided.