File tree Expand file tree Collapse file tree 6 files changed +26
-27
lines changed Expand file tree Collapse file tree 6 files changed +26
-27
lines changed Original file line number Diff line number Diff line change @@ -664,7 +664,10 @@ importer::getNormalInvocationArguments(
664
664
}
665
665
666
666
if (triple.isOSWASI ()) {
667
- invocationArgStrs.insert (invocationArgStrs.end (), {" -D_WASI_EMULATED_MMAN" });
667
+ invocationArgStrs.insert (invocationArgStrs.end (),
668
+ {" -D_WASI_EMULATED_MMAN" ,
669
+ " -D_WASI_EMULATED_SIGNAL" ,
670
+ " -D_WASI_EMULATED_PROCESS_CLOCKS" });
668
671
SmallString<128 > buffer;
669
672
if (auto path = getWasiLibcModuleMapPath (searchPathOpts, triple, buffer)) {
670
673
invocationArgStrs.push_back ((Twine (" -fmodule-map-file=" ) + *path).str ());
Original file line number Diff line number Diff line change @@ -284,7 +284,7 @@ function(_add_target_variant_c_compile_flags)
284
284
endif ()
285
285
286
286
if ("${CFLAGS_SDK} " STREQUAL "WASI" )
287
- list (APPEND result "-D_WASI_EMULATED_MMAN" )
287
+ list (APPEND result "-D_WASI_EMULATED_MMAN" "-D_WASI_EMULATED_SIGNAL" "-D_WASI_EMULATED_PROCESS_CLOCKS" )
288
288
endif ()
289
289
290
290
if ("${CFLAGS_SDK} " STREQUAL "LINUX" )
@@ -294,11 +294,7 @@ function(_add_target_variant_c_compile_flags)
294
294
endif ()
295
295
endif ()
296
296
297
- if ("${CFLAGS_SDK} " STREQUAL "WASI" )
298
- list (APPEND result "-D_WASI_EMULATED_MMAN" )
299
- endif ()
300
-
301
- if (SWIFT_DISABLE_OBJC_INTEROP )
297
+ if (NOT SWIFT_STDLIB_ENABLE_OBJC_INTEROP )
302
298
list (APPEND result "-DSWIFT_OBJC_INTEROP=0" )
303
299
endif ()
304
300
Original file line number Diff line number Diff line change @@ -234,7 +234,7 @@ function(_add_target_variant_swift_compile_flags
234
234
endif ()
235
235
236
236
if ("${sdk} " STREQUAL "WASI" )
237
- list (APPEND result "-Xcc" "-D_WASI_EMULATED_MMAN" )
237
+ list (APPEND result "-Xcc" "-D_WASI_EMULATED_MMAN" "-Xcc" "-D_WASI_EMULATED_SIGNAL" "-Xcc" "-D_WASI_EMULATED_PROCESS_CLOCKS" )
238
238
endif ()
239
239
240
240
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)
@@ -138,7 +137,7 @@ build_target_toolchain() {
138
137
139
138
embed_wasi_sysroot () {
140
139
# Merge wasi-sdk and the toolchain
141
- cp -r " $WASI_SDK_PATH /share/wasi-sysroot " " $DIST_TOOLCHAIN_SDK /usr/share"
140
+ cp -r " $WASI_SYSROOT_PATH " " $DIST_TOOLCHAIN_SDK /usr/share"
142
141
143
142
# Replace absolute sysroot path with relative path
144
143
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,27 +19,27 @@ 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)
39
31
pushd " $workdir "
40
32
41
33
mkdir -p " $BUILD_SDK_PATH "
42
34
43
- install_libxml2
44
- install_icu
45
- install_wasi-sdk
35
+ if [ ! -e " $BUILD_SDK_PATH /libxml2" ]; then
36
+ install_libxml2
37
+ fi
38
+
39
+ if [ ! -e " $BUILD_SDK_PATH /icu" ]; then
40
+ install_icu
41
+ fi
42
+
43
+ if [ ! -e " $BUILD_SDK_PATH /wasi-sysroot" ]; then
44
+ install_wasi-sysroot
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