Skip to content

Commit c891cd2

Browse files
authored
wasi-sdk-pthread.cmake: add --import-memory (WebAssembly#297)
1 parent 95af0b8 commit c891cd2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

wasi-sdk-pthread.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ set(CMAKE_SYSTEM_PROCESSOR wasm32)
99
set(triple wasm32-wasi-threads)
1010
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pthread")
1111
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
12+
# wasi-threads requires --import-memory.
13+
# wasi requires --export-memory.
14+
# (--export-memory is implicit unless --import-memory is given)
15+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--import-memory")
16+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--export-memory")
1217

1318
if(WIN32)
1419
set(WASI_HOST_EXE_SUFFIX ".exe")

0 commit comments

Comments
 (0)