rust-lang / rust-lang/rfcs

WASI cdylib output

Open
#2,703 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-linkage A-target T-compiler
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

Currently wasm32-wasi does not support the cdylib output type, which is unfortunate because this means that only Rust programs can consume programs that target wasi (through the rlib output).

As a motivating example, consider a database wrapper Wasm module. One might want to write it safely in Rust and use it from another Wasm module loaded at runtime. The database wrapper would want to use WASI syscalls to access the database process. This is not yet possible because Rust WASI modules cannot be made into cdylibs.

It looks like all that would need to be done to support this feature is to not link crt1 when compiling to cdylib. This would amount to creating a target that looks like wasm32-unknown-unknown except with wasi sys.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by investigating how the wasm32-wasi target defines cdylib output and where crt1 is linked. Compare it with wasm32-unknown-unknown, then determine the target configuration and validation needed for WASI cdylibs to be consumed by other Wasm modules.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
compilers, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.