|
1 | 1 | # `wasm-component-ld` |
2 | 2 |
|
3 | | -A work-in-progress and/or proof-of-concept linker which wraps `wasm-ld` and then |
4 | | -executes `wit-component` to produce a component output instead of a core wasm |
5 | | -output. Intended for the upcoming `wasm32-wasip2` target in the Rust compiler. |
| 3 | +This crate contains a binary named `wasm-component-ld` which is a wrapper around |
| 4 | +two pieces of functionality used to produce a [WebAssembly Component] |
| 5 | + |
| 6 | +1. The `wasm-ld` linker driver provided by LLVM |
| 7 | +2. The [`wit_component::ComponentEncoder`] type |
| 8 | + |
| 9 | +This binary will first invoke `wasm-ld` and then run the componentization |
| 10 | +process to produce a final component. |
| 11 | + |
| 12 | +[WebAssembly Component]: https://component-model.bytecodealliance.org/ |
| 13 | +[`wit_component::ComponentEncoder`]: https://docs.rs/wit-component/latest/wit_component/struct.ComponentEncoder.html |
| 14 | + |
| 15 | +## Installation |
| 16 | + |
| 17 | +This repository provides [precompiled |
| 18 | +binaries](https://github.com/bytecodealliance/wasm-component-ld/releases) of |
| 19 | +`wasm-component-ld`. This repository can also be installed with [`cargo binstall`]. |
| 20 | + |
| 21 | +Installations of [wasi-sdk] have this binary packaged by default in the sysroot |
| 22 | +and the Rust `wasm32-wasip2` target, upon reaching tier 2, will also come |
| 23 | +packaged with this binary included. |
| 24 | + |
| 25 | +This means that while a version can be installed manually it should not be |
| 26 | +required to do so. |
| 27 | + |
| 28 | +[`cargo binstall`]: https://github.com/cargo-bins/cargo-binstall |
| 29 | +[wasi-sdk]: https://github.com/WebAssembly/wasi-sdk |
| 30 | + |
| 31 | +## Options |
| 32 | + |
| 33 | +The `wasm-component-ld` binary is suitable to use as a linker driver during |
| 34 | +compilations. For Clang and Rust the `wasm32-wasip2` target will automatically |
| 35 | +invoke this binary as the linker. |
| 36 | + |
| 37 | +This means that `wasm-component-ld` forwards most of its arguments to `wasm-ld`. |
| 38 | +Additionally all flags of `wasm-ld` are supported and forwarded to `wasm-ld`. |
| 39 | +For example you can invoke the linker like `wasm-component-ld --max-memory=N |
| 40 | +...`. |
| 41 | + |
| 42 | +The `wasm-component-ld` binary has a few custom arguments for itself as well |
| 43 | +which are not forwarded to `wasm-ld` and can be explored with `-h` or `--help`. |
6 | 44 |
|
7 | 45 | # License |
8 | 46 |
|
|
0 commit comments