Skip to content

Commit

Permalink
Rename thread_spawn import (bytecodealliance#1907)
Browse files Browse the repository at this point in the history
Following the wit-defined ABI:
WebAssembly/wasi-threads#26

cf. WebAssembly/wasi-libc#387
  • Loading branch information
yamt authored Jan 26, 2023
1 parent 4bcad1f commit 1ddb9ef
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/compilation_on_android_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,13 @@ jobs:
- name: build wasi-libc (needed for wasi-threads)
run: |
git clone --branch wasi-sdk-17 https://github.com/WebAssembly/wasi-libc
mkdir wasi-libc
cd wasi-libc
git init
# "Rename thread_spawn import" commit on main branch
git fetch https://github.com/WebAssembly/wasi-libc \
8f5275796a82f8ecfd0833a4f3f444fa37ed4546
git checkout FETCH_HEAD
make \
AR=/opt/wasi-sdk/bin/llvm-ar \
NM=/opt/wasi-sdk/bin/llvm-nm \
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/compilation_on_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,13 @@ jobs:
- name: build wasi-libc (needed for wasi-threads)
run: |
git clone --branch wasi-sdk-17 https://github.com/WebAssembly/wasi-libc
mkdir wasi-libc
cd wasi-libc
git init
# "Rename thread_spawn import" commit on main branch
git fetch https://github.com/WebAssembly/wasi-libc \
8f5275796a82f8ecfd0833a4f3f444fa37ed4546
git checkout FETCH_HEAD
make \
AR=/opt/wasi-sdk/bin/llvm-ar \
NM=/opt/wasi-sdk/bin/llvm-nm \
Expand Down Expand Up @@ -329,4 +334,4 @@ jobs:
mkdir build && cd build
cmake -DWASI_SYSROOT=`pwd`/../../../core/deps/wasi-libc/sysroot ..
cmake --build . --config Release --parallel 4
./iwasm wasm-apps/no_pthread.wasm
./iwasm wasm-apps/no_pthread.wasm
7 changes: 6 additions & 1 deletion .github/workflows/compilation_on_sgx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,13 @@ jobs:
- name: build wasi-libc (needed for wasi-threads)
run: |
git clone --branch wasi-sdk-17 https://github.com/WebAssembly/wasi-libc
mkdir wasi-libc
cd wasi-libc
git init
# "Rename thread_spawn import" commit on main branch
git fetch https://github.com/WebAssembly/wasi-libc \
8f5275796a82f8ecfd0833a4f3f444fa37ed4546
git checkout FETCH_HEAD
make \
AR=/opt/wasi-sdk/bin/llvm-ar \
NM=/opt/wasi-sdk/bin/llvm-nm \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ thread_spawn_wrapper(wasm_exec_env_t exec_env, uint32 start_arg)
}

/* clang-format off */
#define REG_NATIVE_FUNC(func_name, signature) \
{ #func_name, func_name##_wrapper, signature, NULL }
#define REG_NATIVE_FUNC(name, func_name, signature) \
{ name, func_name##_wrapper, signature, NULL }
/* clang-format on */

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

uint32
get_lib_wasi_threads_export_apis(NativeSymbol **p_lib_wasi_threads_apis)
Expand Down
4 changes: 2 additions & 2 deletions samples/wasi-threads/wasm-apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endif ()
set (CMAKE_SYSROOT "${WASI_SYSROOT}")
set (CMAKE_C_COMPILER "${WASI_SDK_DIR}/bin/clang")
set (CMAKE_ASM_COMPILER "${WASI_SDK_DIR}/bin/clang")
set (CMAKE_C_COMPILER_TARGET "wasm32-wasi")
set (CMAKE_EXE_LINKER_FLAGS "-target wasm32-wasi-threads")

function (compile_sample SOURCE_FILE)
get_filename_component (FILE_NAME ${SOURCE_FILE} NAME_WLE)
Expand All @@ -36,4 +36,4 @@ function (compile_sample SOURCE_FILE)
endfunction ()

compile_sample(no_pthread.c wasi_thread_start.S)
compile_sample(thread_termination.c wasi_thread_start.S)
compile_sample(thread_termination.c wasi_thread_start.S)

0 comments on commit 1ddb9ef

Please sign in to comment.