Skip to content
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

Remove wasm32-freestanding-musl #22240

Merged
merged 2 commits into from
Dec 15, 2024

Conversation

alexrp
Copy link
Member

@alexrp alexrp commented Dec 15, 2024

This is, at least today, a very broken target: It doesn't actually build either musl or wasi-libc even if you use -lc. It does give you musl headers, but that's it. Those headers are not terribly useful, however, without any implementation code. You can sort of call some math functions because they just so happen to have implementations in compiler-rt. But that's only true for a small subset, and I don't think users should be relying on the ABI surface of a library that is an implementation detail of the compiler.

Clearly, a freestanding-capable libc of sorts is a useful thing as evidenced by newlib, picolibc, etc existing. However, calling it "musl" is misleading when it isn't actually musl-compatible, nor can it ever be because the musl API surface is inextricably tied to the Linux kernel. In the discussion on #20690, there was agreement that once we split up the API and ABI components in the target string, the API component should be about compatibility, not whether you literally get a particular implementation of it. Also, we decided that Linux musl and wasi-libc musl shouldn't use the same API tag precisely because they're not actually compatible.

(And besides, how would any syscall even be implemented in freestanding? Who or what would we be calling?)

So I think we should remove this triple for now. If we decide to reintroduce something like this, especially once #2879 gets going, we should come up with a bespoke name for it rather than using "musl".

It'll still pick .musl for os.tag == .wasi.
This is, at least today, a very broken target: It doesn't actually build either
musl or wasi-libc even if you use -lc. It does give you musl headers, but that's
it. Those headers are not terribly useful, however, without any implementation
code. You can sort of call some math functions because they just so happen to
have implementations in compiler-rt. But that's only true for a small subset,
and I don't think users should be relying on the ABI surface of a library that
is an implementation detail of the compiler.

Clearly, a freestanding-capable libc of sorts is a useful thing as evidenced by
newlib, picolibc, etc existing. However, calling it "musl" is misleading when it
isn't actually musl-compatible, nor can it ever be because the musl API surface
is inextricably tied to the Linux kernel. In the discussion on ziglang#20690, there was
agreement that once we split up the API and ABI components in the target string,
the API component should be about compatibility, not whether you literally get a
particular implementation of it. Also, we decided that Linux musl and wasi-libc
musl shouldn't use the same API tag precisely because they're not actually
compatible.

(And besides, how would any syscall even be implemented in freestanding? Who or
what would we be calling?)

So I think we should remove this triple for now. If we decide to reintroduce
something like this, especially once ziglang#2879 gets going, we should come up with a
bespoke name for it rather than using "musl".
@alexrp alexrp requested a review from andrewrk December 15, 2024 11:45
@andrewrk andrewrk merged commit eb5c931 into ziglang:master Dec 15, 2024
10 checks passed
@alexrp alexrp deleted the wasm32-freestanding-musl branch December 16, 2024 00:59
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.

2 participants