You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/build_wasm_app.md
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -127,7 +127,7 @@ If we want to build the wasm app with wasi mode, we may build the wasm app with
127
127
to generate a wasm binary with wasi mode, the auxiliary stack size is 8192 bytes, initial memory size is 64 KB, heap base global and data end global are exported, wasi entry function exported (_start function), and all symbols are stripped. Note that it is wasi mode, so libc-wasi should be enabled by runtime embedder or iwasm (with `cmake -DWAMR_BUILD_LIBC_WASI=1`, enabled by iwasm in Linux by default), and normally no need to export main function, by default _start function is executed by iwasm.
128
128
129
129
> Note: for the Rust project, we can set these flags by setting the `rustflags` in the Cargo configuration file, e.g. `<project_dir>/.cargo/config.toml` or `$CARGO_HOME/config.toml`, for example:
130
-
> ```
130
+
> ```toml
131
131
> [build]
132
132
> rustflags = [
133
133
> "-C", "link-arg=--initial-memory=65536",
@@ -151,7 +151,7 @@ Firstly if libc-builtin (-nostdlib) mode meets the requirements, e.g. there are
151
151
If the two globals are exported, and there are no memory.grow and memory.size opcodes (normally nostdlib mode doesn't introduce these opcodes since the libc malloc function isn't built into wasm bytecode), WAMR runtime will truncate the linear memory at the place of \__heap_base and append app heap to the end, so we don't need to allocate the memory specified by `-Wl,--initial-memory=n` which must be at least 64 KB. This is helpful for some embedded devices whose memory resource might be limited.
152
152
153
153
> For the Rust project, please set the flags in the Cargo configuration file, for example:
154
-
> ```
154
+
> ```toml
155
155
> [build]
156
156
> rustflags = [
157
157
> "-C", "link-arg=--export=__heap_base",
@@ -165,15 +165,17 @@ Firstly if libc-builtin (-nostdlib) mode meets the requirements, e.g. there are
165
165
The auxiliary stack is an area of linear memory, normally the size is 64 KB by default which might be a little large for embedded devices and partly used, we can use `-z stack-size=n` to set its size.
166
166
167
167
> For the Rust project, please set the flag in the Cargo configuration file, for example:
168
+
> ```toml
168
169
> [build]
169
170
> rustflags = [
170
171
> "-C", "link-arg=-zstack-size=8192"
171
172
> ]
173
+
> ```
172
174
173
175
- use -O3 and -Wl,--strip-all
174
176
175
177
> For the Rust project, please set the flag in the Cargo configuration file, for example:
0 commit comments