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 @@ -690,7 +690,10 @@ importer::getNormalInvocationArguments(
690
690
}
691
691
692
692
if (triple.isOSWASI ()) {
693
- invocationArgStrs.insert (invocationArgStrs.end (), {" -D_WASI_EMULATED_MMAN" });
693
+ invocationArgStrs.insert (invocationArgStrs.end (),
694
+ {" -D_WASI_EMULATED_MMAN" ,
695
+ " -D_WASI_EMULATED_SIGNAL" ,
696
+ " -D_WASI_EMULATED_PROCESS_CLOCKS" });
694
697
SmallString<128 > buffer;
695
698
if (auto path = getWasiLibcModuleMapPath (searchPathOpts, triple, buffer)) {
696
699
invocationArgStrs.push_back ((Twine (" -fmodule-map-file=" ) + *path).str ());
Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ function(_add_target_variant_c_compile_flags)
288
288
endif ()
289
289
290
290
if ("${CFLAGS_SDK} " STREQUAL "WASI" )
291
- list (APPEND result "-D_WASI_EMULATED_MMAN" )
291
+ list (APPEND result "-D_WASI_EMULATED_MMAN" "-D_WASI_EMULATED_SIGNAL" "-D_WASI_EMULATED_PROCESS_CLOCKS" )
292
292
endif ()
293
293
294
294
if ("${CFLAGS_SDK} " STREQUAL "LINUX" )
@@ -298,10 +298,6 @@ function(_add_target_variant_c_compile_flags)
298
298
endif ()
299
299
endif ()
300
300
301
- if ("${CFLAGS_SDK} " STREQUAL "WASI" )
302
- list (APPEND result "-D_WASI_EMULATED_MMAN" )
303
- endif ()
304
-
305
301
if (NOT SWIFT_STDLIB_ENABLE_OBJC_INTEROP )
306
302
list (APPEND result "-DSWIFT_OBJC_INTEROP=0" )
307
303
endif ()
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ function(_add_target_variant_swift_compile_flags
243
243
endif ()
244
244
245
245
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" )
247
247
endif ()
248
248
249
249
if (NOT BUILD_STANDALONE )
Original file line number Diff line number Diff line change @@ -5,8 +5,7 @@ SOURCE_PATH="$(cd "$(dirname "$0")/../../.." && pwd)"
5
5
UTILS_PATH=" $( cd " $( dirname " $0 " ) " && pwd) "
6
6
7
7
BUILD_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"
10
9
11
10
case $( uname -s) in
12
11
Darwin)
@@ -155,7 +154,7 @@ build_target_toolchain() {
155
154
156
155
embed_wasi_sysroot () {
157
156
# Merge wasi-sdk and the toolchain
158
- cp -r " $WASI_SDK_PATH /share/wasi-sysroot " " $DIST_TOOLCHAIN_SDK /usr/share"
157
+ cp -r " $WASI_SYSROOT_PATH " " $DIST_TOOLCHAIN_SDK /usr/share"
159
158
160
159
# Replace absolute sysroot path with relative path
161
160
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() {
19
19
mv icu_out " $BUILD_SDK_PATH /icu"
20
20
}
21
21
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"
26
24
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
29
26
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"
36
28
}
37
29
38
30
workdir=$( mktemp -d)
@@ -48,6 +40,6 @@ if [ ! -e "$BUILD_SDK_PATH/icu" ]; then
48
40
install_icu
49
41
fi
50
42
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
53
45
fi
Original file line number Diff line number Diff line change 7
7
-lstdc++
8
8
-lm
9
9
-lwasi-emulated-mman
10
+ -lwasi-emulated-signal
11
+ -lwasi-emulated-process-clocks
10
12
-Xlinker --error-limit=0
11
13
-Xlinker --no-gc-sections
12
14
-Xlinker --threads=1
13
- -D_WASI_EMULATED_MMAN
You can’t perform that action at this time.
0 commit comments