Skip to content

Conversation

@ricochet
Copy link

@ricochet ricochet commented Jan 6, 2026

This change enables components to be built without a wasi:cli/run export.

  • Command mode (-mexec-model=command or default): Links crt1-command.o which contains exports_wasi_cli_run_run
  • Reactor mode (-mexec-model=reactor): Links crt1-reactor.o which only has _initialize

I have a bit of a chicken and egg problem after removing the run export from defined-symbols.txt which seems to be our only test for this. I was able to test by adding additional checks in src/llvm-project/clang/test/Driver/wasm-toolchain.c but this wasi-libc change needs to land first for those tests to pass.

cc @alexcrichton, there are a number of refactors in flight leading up to #700. No rush on this one, it's something that's bugged me for a while.

@ricochet ricochet marked this pull request as draft January 6, 2026 17:01
Copy link
Collaborator

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks reasonable to me. From what I can tell __main_void.c is included in libc.so and libc.a and it makes sense that this should live in crt1-command.o

Comment on lines -114 to -115
// TODO: this is supposed to be unnecessary, but functional/env.c fails
// without it
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this TODO might still be applicable? Mind carrying it over?

@alexcrichton
Copy link
Collaborator

Hm, actually, on second though, this isn't actually used at all right now. If exports_wasi_cli_run_run is deleted entirely I believe everything should work. I'm investigating that separately, but @ricochet in the meantime if you want to just drop this symbol outright (which also seems good) I think that's reasonable

@alexcrichton
Copy link
Collaborator

Ok I tracked things down in #710, which purges the usage of the adapter on wasip2 targets. This PR is still useful in its own right, however, by deleting the symbol that nothing ended up using

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