From bbec452953e87191d4937cf474fcccff5b6fea73 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 10 Nov 2022 23:45:20 +0000 Subject: [PATCH] Bug 1800150 - Use the clang-trunk-based wasi sysroot on the toolchains branch. r=firefox-build-system-reviewers,ahochheiden And because it's built against clang-trunk, it needs the same patch as compiler-rt-wasi. Differential Revision: https://phabricator.services.mozilla.com/D161838 --- taskcluster/ci/toolchain/sysroot.yml | 9 ++++++- .../scripts/misc/build-compiler-rt-wasi.sh | 27 ++----------------- .../scripts/misc/build-sysroot-wasi.sh | 2 ++ taskcluster/scripts/misc/wasi-sdk.patch | 23 ++++++++++++++++ 4 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 taskcluster/scripts/misc/wasi-sdk.patch diff --git a/taskcluster/ci/toolchain/sysroot.yml b/taskcluster/ci/toolchain/sysroot.yml index a8a53941b9779..50bd80b2d920f 100644 --- a/taskcluster/ci/toolchain/sysroot.yml +++ b/taskcluster/ci/toolchain/sysroot.yml @@ -68,7 +68,10 @@ sysroot-wasm32-wasi-clang-15: symbol: TL(sysroot-wasi-15) run: script: build-sysroot-wasi.sh - toolchain-alias: sysroot-wasm32-wasi + toolchain-alias: + by-project: + toolchains: null + default: sysroot-wasm32-wasi toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst fetches: fetch: @@ -85,6 +88,10 @@ sysroot-wasm32-wasi-clang-trunk: symbol: TL(sysroot-wasi-trunk) run: script: build-sysroot-wasi.sh + toolchain-alias: + by-project: + toolchains: sysroot-wasm32-wasi + default: null toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst fetches: fetch: diff --git a/taskcluster/scripts/misc/build-compiler-rt-wasi.sh b/taskcluster/scripts/misc/build-compiler-rt-wasi.sh index 9bcdfefa29f79..52dcad7383b66 100755 --- a/taskcluster/scripts/misc/build-compiler-rt-wasi.sh +++ b/taskcluster/scripts/misc/build-compiler-rt-wasi.sh @@ -4,34 +4,11 @@ set -x -e -v artifact=$(basename $TOOLCHAIN_ARTIFACT) dir=${artifact%.tar.*} +patch -d $MOZ_FETCHES_DIR/wasi-sdk -p1 < $(dirname $0)/wasi-sdk.patch + cd $MOZ_FETCHES_DIR/wasi-sdk LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project -# Apply patch from https://github.com/WebAssembly/wasi-libc/pull/344. -patch -p1 <<'EOF' -diff --git a/src/wasi-libc/Makefile b/src/wasi-libc/Makefile -index 44acdee..6e01bed 100644 ---- a/src/wasi-libc/Makefile -+++ b/src/wasi-libc/Makefile -@@ -556,6 +556,8 @@ check-symbols: startup_files libc - -U__clang_version__ \ - -U__clang_literal_encoding__ \ - -U__clang_wide_literal_encoding__ \ -+ -U__wasm_mutable_globals__ \ -+ -U__wasm_sign_ext__ \ - -U__GNUC__ \ - -U__GNUC_MINOR__ \ - -U__GNUC_PATCHLEVEL__ \ -@@ -565,6 +567,7 @@ check-symbols: startup_files libc - -U__BITINT_MAXWIDTH__ \ - -U__FLT_EVAL_METHOD__ -Wno-builtin-macro-redefined \ - | sed -e 's/__[[:upper:][:digit:]]*_ATOMIC_\([[:upper:][:digit:]_]*\)_LOCK_FREE/__compiler_ATOMIC_\1_LOCK_FREE/' \ -+ | sed -e 's/__GNUC_VA_LIST $$/__GNUC_VA_LIST 1/' \ - | grep -v '^#define __FLT16_' \ - | grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \ - > "$(SYSROOT_SHARE)/predefined-macros.txt" -EOF - mkdir -p build/install/wasi # The wasi-sdk build system wants to build clang itself. We trick it into # thinking it did, and put our own clang where it would have built its own. diff --git a/taskcluster/scripts/misc/build-sysroot-wasi.sh b/taskcluster/scripts/misc/build-sysroot-wasi.sh index 68866508841ab..1a56e3139fa8b 100755 --- a/taskcluster/scripts/misc/build-sysroot-wasi.sh +++ b/taskcluster/scripts/misc/build-sysroot-wasi.sh @@ -4,6 +4,8 @@ set -x -e -v artifact=$(basename $TOOLCHAIN_ARTIFACT) sysroot=${artifact%.tar.*} +patch -d $MOZ_FETCHES_DIR/wasi-sdk -p1 < $(dirname $0)/wasi-sdk.patch + cd $MOZ_FETCHES_DIR/wasi-sdk LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project diff --git a/taskcluster/scripts/misc/wasi-sdk.patch b/taskcluster/scripts/misc/wasi-sdk.patch new file mode 100644 index 0000000000000..f6a5841621202 --- /dev/null +++ b/taskcluster/scripts/misc/wasi-sdk.patch @@ -0,0 +1,23 @@ +Patch from https://github.com/WebAssembly/wasi-libc/pull/344. + +diff --git a/src/wasi-libc/Makefile b/src/wasi-libc/Makefile +index 44acdee..6e01bed 100644 +--- a/src/wasi-libc/Makefile ++++ b/src/wasi-libc/Makefile +@@ -556,6 +556,8 @@ check-symbols: startup_files libc + -U__clang_version__ \ + -U__clang_literal_encoding__ \ + -U__clang_wide_literal_encoding__ \ ++ -U__wasm_mutable_globals__ \ ++ -U__wasm_sign_ext__ \ + -U__GNUC__ \ + -U__GNUC_MINOR__ \ + -U__GNUC_PATCHLEVEL__ \ +@@ -565,6 +567,7 @@ check-symbols: startup_files libc + -U__BITINT_MAXWIDTH__ \ + -U__FLT_EVAL_METHOD__ -Wno-builtin-macro-redefined \ + | sed -e 's/__[[:upper:][:digit:]]*_ATOMIC_\([[:upper:][:digit:]_]*\)_LOCK_FREE/__compiler_ATOMIC_\1_LOCK_FREE/' \ ++ | sed -e 's/__GNUC_VA_LIST $$/__GNUC_VA_LIST 1/' \ + | grep -v '^#define __FLT16_' \ + | grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \ + > "$(SYSROOT_SHARE)/predefined-macros.txt"