Skip to content

Commit a67c1c1

Browse files
authored
doc/build_wasm_app.md: Mention a glitch with LLVM 13 and later (#1255)
References: https://reviews.llvm.org/D81689#3611504 WebAssembly/WASI#471
1 parent 625d591 commit a67c1c1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

doc/build_wasm_app.md

+5
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ Firstly if libc-builtin (-nostdlib) mode meets the requirements, e.g. there are
160160

161161
Most of the above methods are also available for libc-wasi mode, besides them, we can export malloc and free functions with `-Wl,--export=malloc -Wl,--export=free` option, so WAMR runtime will disable its app heap and call the malloc/free function exported to allocate/free the memory from/to the heap space managed by libc.
162162

163+
Note: wasm-ld from LLVM 13 and later automatically inserts dtor calls
164+
for exported funtions. It breaks the malloc/free export mentioned above.
165+
A workaround: Add `-Wl,--export=__wasm_call_ctors`, which happens to
166+
prevent the automatic insertions for the current implementation.
167+
163168
## 3. Build wasm app with pthread support
164169

165170
Please ref to [pthread library](./pthread_library.md) for more details.

0 commit comments

Comments
 (0)