File tree Expand file tree Collapse file tree 6 files changed +16
-25
lines changed Expand file tree Collapse file tree 6 files changed +16
-25
lines changed Original file line number Diff line number Diff line change @@ -682,7 +682,10 @@ importer::getNormalInvocationArguments(
682682 }
683683
684684 if (triple.isOSWASI ()) {
685- invocationArgStrs.insert (invocationArgStrs.end (), {" -D_WASI_EMULATED_MMAN" });
685+ invocationArgStrs.insert (invocationArgStrs.end (),
686+ {" -D_WASI_EMULATED_MMAN" ,
687+ " -D_WASI_EMULATED_SIGNAL" ,
688+ " -D_WASI_EMULATED_PROCESS_CLOCKS" });
686689 SmallString<128 > buffer;
687690 if (auto path = getWasiLibcModuleMapPath (searchPathOpts, triple, buffer)) {
688691 invocationArgStrs.push_back ((Twine (" -fmodule-map-file=" ) + *path).str ());
Original file line number Diff line number Diff line change @@ -290,7 +290,7 @@ function(_add_target_variant_c_compile_flags)
290290 endif ()
291291
292292 if ("${CFLAGS_SDK} " STREQUAL "WASI" )
293- list (APPEND result "-D_WASI_EMULATED_MMAN" )
293+ list (APPEND result "-D_WASI_EMULATED_MMAN" "-D_WASI_EMULATED_SIGNAL" "-D_WASI_EMULATED_PROCESS_CLOCKS" )
294294 endif ()
295295
296296 if ("${CFLAGS_SDK} " STREQUAL "LINUX" )
@@ -300,10 +300,6 @@ function(_add_target_variant_c_compile_flags)
300300 endif ()
301301 endif ()
302302
303- if ("${CFLAGS_SDK} " STREQUAL "WASI" )
304- list (APPEND result "-D_WASI_EMULATED_MMAN" )
305- endif ()
306-
307303 if (NOT SWIFT_STDLIB_ENABLE_OBJC_INTEROP)
308304 list (APPEND result "-DSWIFT_OBJC_INTEROP=0" )
309305 endif ()
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ function(_add_target_variant_swift_compile_flags
243243 endif ()
244244
245245 if ("${sdk} " STREQUAL "WASI" )
246- list (APPEND result "-Xcc" "-D_WASI_EMULATED_MMAN" )
246+ list (APPEND result "-Xcc" "-D_WASI_EMULATED_MMAN" "-Xcc" "-D_WASI_EMULATED_SIGNAL" "-Xcc" "-D_WASI_EMULATED_PROCESS_CLOCKS" )
247247 endif ()
248248
249249 if (NOT BUILD_STANDALONE)
Original file line number Diff line number Diff line change @@ -5,8 +5,7 @@ SOURCE_PATH="$(cd "$(dirname "$0")/../../.." && pwd)"
55UTILS_PATH=" $( cd " $( dirname " $0 " ) " && pwd) "
66
77BUILD_SDK_PATH=" $SOURCE_PATH /build-sdk"
8- WASI_SDK_PATH=" $BUILD_SDK_PATH /wasi-sdk"
9- WASI_SYSROOT_PATH=" $WASI_SDK_PATH /share/wasi-sysroot"
8+ WASI_SYSROOT_PATH=" $BUILD_SDK_PATH /wasi-sysroot"
109
1110case $( uname -s) in
1211 Darwin)
@@ -154,7 +153,7 @@ build_target_toolchain() {
154153
155154embed_wasi_sysroot () {
156155 # Merge wasi-sdk and the toolchain
157- cp -r " $WASI_SDK_PATH /share/wasi-sysroot " " $DIST_TOOLCHAIN_SDK /usr/share"
156+ cp -r " $WASI_SYSROOT_PATH " " $DIST_TOOLCHAIN_SDK /usr/share"
158157
159158 # Replace absolute sysroot path with relative path
160159 sed -i.bak -e " s@\" .*/include@\" ../../../../share/wasi-sysroot/include@g" " $DIST_TOOLCHAIN_SDK /usr/lib/swift/wasi/wasm32/wasi.modulemap"
Original file line number Diff line number Diff line change @@ -19,20 +19,12 @@ install_icu() {
1919 mv icu_out " $BUILD_SDK_PATH /icu"
2020}
2121
22- install_wasi-sdk () {
23- # We only use wasi-sysroot and do not use binaries in wasi-sdk,
24- # so build machine's os and wasi-sdk's host os don't have to be matched
25- WASI_SDK_URL=" https://github.com/swiftwasm/wasi-sdk/releases/download/0.2.2-swiftwasm/dist-ubuntu-18.04.zip"
22+ install_wasi-sysroot () {
23+ WASI_SYSROOT_URL=" https://github.com/swiftwasm/wasi-sdk-build/releases/download/wasi-sdk-14%2Bswiftwasm-2022-03-13/wasi-sysroot.tar.gz"
2624
27- curl -L -o dist-wasi-sdk.zip " $WASI_SDK_URL "
28- unzip -u dist-wasi-sdk.zip -d .
25+ curl -L " $WASI_SYSROOT_URL " | tar xz
2926
30- WASI_SDK_TAR_PATH=$( find . -type f -name " wasi-sdk-*" )
31- WASI_SDK_FULL_NAME=$( basename " $WASI_SDK_TAR_PATH " -linux.tar.gz)
32- tar xfz " $WASI_SDK_TAR_PATH "
33-
34- rm -rf " $BUILD_SDK_PATH /wasi-sdk"
35- mv " $WASI_SDK_FULL_NAME " " $BUILD_SDK_PATH /wasi-sdk"
27+ mv " wasi-sysroot" " $BUILD_SDK_PATH /wasi-sysroot"
3628}
3729
3830workdir=$( mktemp -d)
@@ -48,6 +40,6 @@ if [ ! -e "$BUILD_SDK_PATH/icu" ]; then
4840 install_icu
4941fi
5042
51- if [ ! -e " $BUILD_SDK_PATH /wasi-sdk " ]; then
52- install_wasi-sdk
43+ if [ ! -e " $BUILD_SDK_PATH /wasi-sysroot " ]; then
44+ install_wasi-sysroot
5345fi
Original file line number Diff line number Diff line change 77-lstdc++
88-lm
99-lwasi-emulated-mman
10+ -lwasi-emulated-signal
11+ -lwasi-emulated-process-clocks
1012-Xlinker --error-limit=0
1113-Xlinker --no-gc-sections
1214-Xlinker --threads=1
13- -D_WASI_EMULATED_MMAN
You can’t perform that action at this time.
0 commit comments