Skip to content

Commit 42f8fed

Browse files
authored
Rename thread_spawn import (bytecodealliance#1907)
Following the wit-defined ABI: WebAssembly/wasi-threads#26 cf. WebAssembly/wasi-libc#387
1 parent 8795630 commit 42f8fed

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

.github/workflows/compilation_on_android_ubuntu.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,13 @@ jobs:
326326
327327
- name: build wasi-libc (needed for wasi-threads)
328328
run: |
329-
git clone --branch wasi-sdk-17 https://github.com/WebAssembly/wasi-libc
329+
mkdir wasi-libc
330330
cd wasi-libc
331+
git init
332+
# "Rename thread_spawn import" commit on main branch
333+
git fetch https://github.com/WebAssembly/wasi-libc \
334+
8f5275796a82f8ecfd0833a4f3f444fa37ed4546
335+
git checkout FETCH_HEAD
331336
make \
332337
AR=/opt/wasi-sdk/bin/llvm-ar \
333338
NM=/opt/wasi-sdk/bin/llvm-nm \

.github/workflows/compilation_on_macos.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,13 @@ jobs:
268268
269269
- name: build wasi-libc (needed for wasi-threads)
270270
run: |
271-
git clone --branch wasi-sdk-17 https://github.com/WebAssembly/wasi-libc
271+
mkdir wasi-libc
272272
cd wasi-libc
273+
git init
274+
# "Rename thread_spawn import" commit on main branch
275+
git fetch https://github.com/WebAssembly/wasi-libc \
276+
8f5275796a82f8ecfd0833a4f3f444fa37ed4546
277+
git checkout FETCH_HEAD
273278
make \
274279
AR=/opt/wasi-sdk/bin/llvm-ar \
275280
NM=/opt/wasi-sdk/bin/llvm-nm \
@@ -329,4 +334,4 @@ jobs:
329334
mkdir build && cd build
330335
cmake -DWASI_SYSROOT=`pwd`/../../../core/deps/wasi-libc/sysroot ..
331336
cmake --build . --config Release --parallel 4
332-
./iwasm wasm-apps/no_pthread.wasm
337+
./iwasm wasm-apps/no_pthread.wasm

.github/workflows/compilation_on_sgx.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,13 @@ jobs:
270270
271271
- name: build wasi-libc (needed for wasi-threads)
272272
run: |
273-
git clone --branch wasi-sdk-17 https://github.com/WebAssembly/wasi-libc
273+
mkdir wasi-libc
274274
cd wasi-libc
275+
git init
276+
# "Rename thread_spawn import" commit on main branch
277+
git fetch https://github.com/WebAssembly/wasi-libc \
278+
8f5275796a82f8ecfd0833a4f3f444fa37ed4546
279+
git checkout FETCH_HEAD
275280
make \
276281
AR=/opt/wasi-sdk/bin/llvm-ar \
277282
NM=/opt/wasi-sdk/bin/llvm-nm \

core/iwasm/libraries/lib-wasi-threads/lib_wasi_threads_wrapper.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ thread_spawn_wrapper(wasm_exec_env_t exec_env, uint32 start_arg)
148148
}
149149

150150
/* clang-format off */
151-
#define REG_NATIVE_FUNC(func_name, signature) \
152-
{ #func_name, func_name##_wrapper, signature, NULL }
151+
#define REG_NATIVE_FUNC(name, func_name, signature) \
152+
{ name, func_name##_wrapper, signature, NULL }
153153
/* clang-format on */
154154

155155
static NativeSymbol native_symbols_lib_wasi_threads[] = { REG_NATIVE_FUNC(
156-
thread_spawn, "(i)i") };
156+
"thread-spawn", thread_spawn, "(i)i") };
157157

158158
uint32
159159
get_lib_wasi_threads_export_apis(NativeSymbol **p_lib_wasi_threads_apis)

samples/wasi-threads/wasm-apps/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ endif ()
1414
set (CMAKE_SYSROOT "${WASI_SYSROOT}")
1515
set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
1616
set (CMAKE_ASM_COMPILER "${WASI_SDK_DIR}/bin/clang")
17-
set (CMAKE_C_COMPILER_TARGET "wasm32-wasi")
17+
set (CMAKE_EXE_LINKER_FLAGS "-target wasm32-wasi-threads")
1818

1919
function (compile_sample SOURCE_FILE)
2020
get_filename_component (FILE_NAME ${SOURCE_FILE} NAME_WLE)
@@ -36,4 +36,4 @@ function (compile_sample SOURCE_FILE)
3636
endfunction ()
3737

3838
compile_sample(no_pthread.c wasi_thread_start.S)
39-
compile_sample(thread_termination.c wasi_thread_start.S)
39+
compile_sample(thread_termination.c wasi_thread_start.S)

0 commit comments

Comments
 (0)