Skip to content

Commit 041aaf0

Browse files
Build libclang_rt.builtin for wasip1-threads target separately
`compiler-rt/lib/builtins/atomic.c` has to be built with atomics feature enabled for wasip1-threads target. We had been sharing the same libclang_rt.builtins.a for both wasi and wasip1-threads targets, but enabling atomics feature breaks non-threaded wasi target due to unnecessary feature dependencies. swiftlang/swift#73077 will build libclang_rt.builtins.a separately and install wasi-sysroot under different directories for each target.
1 parent 46cfb01 commit 041aaf0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

schemes/main/build/build-target-toolchain.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ build_target_toolchain() {
4040

4141
rm -rf "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
4242
# XXX: Is this the right way to install compiler-rt?
43-
cp -R "$TARGET_BUILD_ROOT/wasi-sysroot/lib/$COMPILER_RT_OS_DIR" "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
43+
cp -R "$TARGET_BUILD_ROOT/wasi-sysroot/$TRIPLE/lib/$COMPILER_RT_OS_DIR" "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
4444

4545
# FIXME: Clang resource directory installation is not the best way currently.
4646
# We currently have two copies of compiler headers copied from the base toolchain in
@@ -68,7 +68,7 @@ build_target_corelibs() {
6868
"$LLVM_BIN_DIR"
6969
"$CLANG_BIN_DIR"
7070
"$SWIFT_BIN_DIR"
71-
"$WASI_SYSROOT_PATH"
71+
"$WASI_SYSROOT_PATH/$TRIPLE"
7272
)
7373
"$SCHEMES_BUILD_PATH/build-foundation.sh" "${CORELIBS_ARGS[@]}" "$TRIPLE"
7474
"$SCHEMES_BUILD_PATH/build-xctest.sh" "${CORELIBS_ARGS[@]}" "$TRIPLE"
@@ -160,13 +160,13 @@ main() {
160160
"$OPTIONS_SWIFT_BIN"
161161
)
162162

163-
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasi" "wasmstdlib" "wasi"
164-
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1-threads" "wasmthreadsstdlib" "wasip1"
163+
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-wasi" "wasmstdlib" "wasi"
164+
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-wasip1-threads" "wasmthreadsstdlib" "wasip1"
165165

166166
rsync -av "$WASI_SYSROOT_PATH/" "$PACKAGING_DIR/wasi-sysroot/"
167167

168-
build_target_corelibs "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasi"
169-
build_target_corelibs "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1-threads"
168+
build_target_corelibs "${BUILD_TOOLS_ARGS[@]}" "wasm32-wasi"
169+
build_target_corelibs "${BUILD_TOOLS_ARGS[@]}" "wasm32-wasip1-threads"
170170
}
171171

172172
main "$@"

tools/build/package-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def main():
440440

441441
toolchain_channel = derive_toolchain_channel(options.scheme)
442442
for target_triple in [
443-
"wasm32-unknown-wasi", "wasm32-unknown-wasip1-threads"
443+
"wasm32-wasi", "wasm32-wasip1-threads"
444444
]:
445445
snapshot_info = SnapshotInfo(
446446
now.year, now.month, now.day,

0 commit comments

Comments
 (0)