Bug 1724522 - Split wasi-sysroot in two separate toolchains. r=firefox-build-system-reviewers,mhentges

The wasi-sysroot toolchain contains both a sysroot for wasi and a
compiler-rt for clang. That makes it impractical to use as a
bootstrapped sysroot for wasm32-wasi builds of Spidermonkey.

We thus split the toolchain in two, one for the compiler-rt and one
for the sysroot. Ideally, the compiler-rt one would avoid building
clang/llvm the same way the sysroot one does, but that leads to
a case of chicken-and-egg, because the compiler-rt is needed to build
the clang toolchain. Eventually, the clang build would be split from
the addition of the compiler-rt, but we're not there yet.

Differential Revision: https://phabricator.services.mozilla.com/D122402
This commit is contained in:
Mike Hommey 2021-08-13 07:07:45 +00:00
Родитель 726d5d7ef7
Коммит 6474710c7a
23 изменённых файлов: 183 добавлений и 113 удалений

Просмотреть файл

@ -993,19 +993,17 @@ if __name__ == "__main__":
)
# Copy the wasm32 builtins to the final_inst_dir if the archive is present.
if "wasi-sysroot" in config:
sysroot = config["wasi-sysroot"].format(**os.environ)
if os.path.isdir(sysroot):
for srcdir in glob.glob(
os.path.join(sysroot, "lib", "clang", "*", "lib", "wasi")
if "wasi-compiler-rt" in config:
compiler_rt = config["wasi-compiler-rt"].format(**os.environ)
if os.path.isdir(compiler_rt):
for libdir in glob.glob(
os.path.join(final_inst_dir, "lib", "clang", "*", "lib")
):
print("Copying from wasi-sysroot srcdir %s" % srcdir)
srcdir = os.path.join(compiler_rt, "lib", "wasi")
print("Copying from wasi-compiler-rt srcdir %s" % srcdir)
# Copy the contents of the "lib/wasi" subdirectory to the
# appropriate location in final_inst_dir.
version = os.path.basename(os.path.dirname(os.path.dirname(srcdir)))
destdir = os.path.join(
final_inst_dir, "lib", "clang", version, "lib", "wasi"
)
destdir = os.path.join(libdir, "wasi")
mkdir_p(destdir)
copy_tree(srcdir, destdir)

Просмотреть файл

@ -8,7 +8,7 @@
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"wasi-sysroot": "{MOZ_FETCHES_DIR}/wasi-sysroot",
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt",
"patches": [
"static-llvm-symbolizer_clang_12.patch",
"find_symbolizer_linux_clang_10.patch",

Просмотреть файл

@ -12,7 +12,7 @@
"ranlib": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-ranlib",
"libtool": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-libtool",
"ld": "{MOZ_FETCHES_DIR}/clang/bin/clang",
"wasi-sysroot": "{MOZ_FETCHES_DIR}/wasi-sysroot",
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt",
"patches": [
"static-llvm-symbolizer_clang_12.patch",
"compiler-rt-cross-compile.patch",

Просмотреть файл

@ -8,7 +8,7 @@
"cc": "cl.exe",
"cxx": "cl.exe",
"ml": "ml64.exe",
"wasi-sysroot": "{MOZ_FETCHES_DIR}/wasi-sysroot",
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt",
"patches": [
"unpoison-thread-stacks_clang_10.patch",
"downgrade-mangling-error_clang_12.patch",

Просмотреть файл

@ -7,7 +7,7 @@
"cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
"as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
"wasi-sysroot": "{MOZ_FETCHES_DIR}/wasi-sysroot",
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt",
"patches": [
"static-llvm-symbolizer_clang_12.patch",
"find_symbolizer_linux_clang_10.patch",

Просмотреть файл

@ -1,5 +1,5 @@
{
"configure-args": "--enable-application=js --target=wasm32-unknown-wasi --with-sysroot=${MOZ_FETCHES_DIR}/wasi-sysroot/share/wasi-sysroot/ --disable-stdcxx-compat --disable-gold --without-system-zlib --without-intl-api --disable-jit --disable-shared-js --disable-shared-memory --disable-tests --disable-cranelift --disable-clang-plugin",
"configure-args": "--enable-application=js --target=wasm32-unknown-wasi --with-sysroot=${MOZ_FETCHES_DIR}/sysroot-wasm32-wasi/ --disable-stdcxx-compat --disable-gold --without-system-zlib --without-intl-api --disable-jit --disable-shared-js --disable-shared-memory --disable-tests --disable-cranelift --disable-clang-plugin",
"optimize": true,
"debug": false,
"nspr": false,

Просмотреть файл

@ -46,7 +46,7 @@ linux64/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-x11/opt:
description: "Linux64 Opt (X11-only)"
@ -84,7 +84,7 @@ linux64-x11/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu-x11
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-plain/opt:
description: "Linux64 Opt Plain"
@ -167,7 +167,7 @@ linux64-gcc/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-plain-clang-trunk/opt:
description: "Linux64 Opt Plain with clang trunk"
@ -254,7 +254,7 @@ linux64-fuzzing/debug:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -301,7 +301,7 @@ linux64-fuzzing-noopt/debug:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -349,7 +349,7 @@ linux64/debug:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64/codeql-cpp:
description: Builds a C++ codeql database
@ -400,7 +400,7 @@ linux64/codeql-cpp:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
notifications:
subject: '{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]} linux64 codeql-cpp status'
message: '{task[shipping-product]} {release_config[version]} build{release_config[build_number]}/{config[params][project]} linux64 codeql-cpp status'
@ -502,7 +502,7 @@ linux64-devedition/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux/opt:
description: "Linux32 Opt"
@ -545,7 +545,7 @@ linux/opt:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux/debug:
description: "Linux32 Debug"
@ -589,7 +589,7 @@ linux/debug:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux-rusttests/opt:
description: "Linux32 Rust Tests Opt"
@ -631,7 +631,7 @@ linux-rusttests/opt:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
test-inclusive: [rusttests]
@ -675,7 +675,7 @@ linux-rusttests/debug:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
test-inclusive: [rusttests]
@ -726,7 +726,7 @@ linux-devedition/opt:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux-shippable/opt:
description: "Linux32 Shippable"
@ -772,7 +772,7 @@ linux-shippable/opt:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux-reproduced/opt:
description: "Linux32 Reproduced"
@ -816,7 +816,7 @@ linux-reproduced/opt:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-reproduced/opt:
description: "Linux64 Reproduced"
@ -859,7 +859,7 @@ linux64-reproduced/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-asan/opt:
description: "Linux64 Opt ASAN"
@ -901,7 +901,7 @@ linux64-asan/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-tsan/opt:
description: "Linux64 Opt TSAN"
@ -943,7 +943,7 @@ linux64-tsan/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-tsan-fuzzing/opt:
description: "Linux64 Fuzzing Opt TSAN"
@ -988,7 +988,7 @@ linux64-tsan-fuzzing/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -1035,7 +1035,7 @@ linux64-asan-fuzzing/noopt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -1082,7 +1082,7 @@ linux64-asan-fuzzing/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -1129,7 +1129,7 @@ linux64-asan-fuzzing-ccov/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-fuzzing-ccov/opt:
description: "Linux64 Fuzzing Opt w/ Coverage"
@ -1171,7 +1171,7 @@ linux64-fuzzing-ccov/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -1226,7 +1226,7 @@ linux64-asan-reporter-shippable/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-asan/debug:
description: "Linux64 Debug ASAN"
@ -1267,7 +1267,7 @@ linux64-asan/debug:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -1318,7 +1318,7 @@ linux64-shippable/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-noopt/debug:
description: "Linux64 No-optimize Debug"
@ -1361,7 +1361,7 @@ linux64-noopt/debug:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-rusttests/opt:
description: "Linux64 Rust Tests Opt"
@ -1402,7 +1402,7 @@ linux64-rusttests/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
test-inclusive: [rusttests]
@ -1445,7 +1445,7 @@ linux64-rusttests/debug:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
test-inclusive: [rusttests]
@ -1494,7 +1494,7 @@ linux64-ccov/opt:
- linux64-node
- linux64-grcov
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-ccov/debug:
description: "Linux64-CCov Debug"
@ -1536,7 +1536,7 @@ linux64-ccov/debug:
- linux64-node
- linux64-grcov
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-add-on-devel/opt:
description: "Linux64 add-on-devel"
@ -1576,7 +1576,7 @@ linux64-add-on-devel/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-aarch64/opt:
description: "Linux64 aarch64 Opt"
@ -1619,7 +1619,7 @@ linux64-aarch64/opt:
- linux64-node
- sysroot-aarch64-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -1666,7 +1666,7 @@ linux-gcp/debug:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-backstop: null
@ -1711,7 +1711,7 @@ linux-gcp/opt:
- linux64-node
- sysroot-i686-linux-gnu
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
linux64-gcp/debug:
description: "Linux64 Debug - built on GCP"
@ -1754,7 +1754,7 @@ linux64-gcp/debug:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-backstop: null
@ -1798,4 +1798,4 @@ linux64-gcp/opt:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi

Просмотреть файл

@ -55,7 +55,7 @@ macosx64/debug:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64/opt:
description: "MacOS X x64 Cross-compile"
@ -84,7 +84,7 @@ macosx64/opt:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-asan-fuzzing/opt:
description: "MacOS X x64 Cross-compile Fuzzing ASAN"
@ -111,7 +111,7 @@ macosx64-asan-fuzzing/opt:
- linux64-sccache
- macosx64-llvm-symbolizer
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -141,7 +141,7 @@ macosx64-fuzzing/debug:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null
@ -179,7 +179,7 @@ macosx64-x64-devedition/opt:
- linux64-cctools-port
- linux64-clang-macosx-cross
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-aarch64-devedition/opt:
description: "MacOS X Dev Edition Aarch64 (shippable)"
@ -217,7 +217,7 @@ macosx64-aarch64-devedition/opt:
- linux64-cctools-port
- linux64-clang-macosx-cross
- macosx64-sdk-11.0
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-devedition/opt:
description: "MacOS X Dev Edition Universal"
@ -383,7 +383,7 @@ macosx64-noopt/debug:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-add-on-devel/opt:
description: "MacOS X x64 add-on-devel"
@ -409,7 +409,7 @@ macosx64-add-on-devel/opt:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-x64-shippable/opt:
description: "MacOS X x64 Cross-compile"
@ -441,7 +441,7 @@ macosx64-x64-shippable/opt:
- linux64-cctools-port
- linux64-clang-macosx-cross
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-aarch64-shippable/opt:
description: "MacOS X aarch64 Cross-compile"
@ -476,7 +476,7 @@ macosx64-aarch64-shippable/opt:
- linux64-cctools-port
- linux64-clang-macosx-cross
- macosx64-sdk-11.0
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-shippable/opt:
description: "MacOS X Universal"
@ -643,7 +643,7 @@ macosx64-ccov/opt:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-gcp/debug:
description: "MacOS X x64 Cross-compile - built on GCP"
@ -673,7 +673,7 @@ macosx64-gcp/debug:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-backstop: null
@ -704,4 +704,4 @@ macosx64-gcp/opt:
- linux64-clang-macosx-cross
- linux64-sccache
- macosx64-sdk-10.12
- wasi-sysroot
- sysroot-wasm32-wasi

Просмотреть файл

@ -75,6 +75,6 @@ jobs:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-backstop: null

Просмотреть файл

@ -94,7 +94,7 @@ jobs:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-shippable/opt:
description: "MacOS X x64 Cross-compile Instrumented"
@ -133,7 +133,7 @@ jobs:
- linux64-node
- macosx64-sdk-10.12
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
android-x86-shippable/opt:
description: "Android 5.0 x86 PGO instrumented"

Просмотреть файл

@ -58,7 +58,7 @@ jobs:
- linux64-cbindgen
- linux64-dump_syms
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
macosx64-searchfox/debug:
description: "MacOS X x64 Debug Cross-compile Searchfox"
@ -99,7 +99,7 @@ jobs:
- linux64-dump_syms
- macosx64-sdk-10.12
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
win64-searchfox/debug:
description: "Win64 Searchfox Debug (clang-cl)"

Просмотреть файл

@ -25,7 +25,7 @@ job-defaults:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
when:
# Extension list from https://hg.mozilla.org/mozilla-central/file/default/python/mozbuild/mozbuild/mach_commands.py#l1664
files-changed:

Просмотреть файл

@ -324,7 +324,7 @@ sm-linux64-wasi/opt:
- linux64-cbindgen
- linux64-dump_syms
- sysroot-x86_64-linux-gnu
- wasi-sysroot-12
- sysroot-wasm32-wasi
sm-msan-linux64/opt:
description: "Spidermonkey Memory Sanitizer"

Просмотреть файл

@ -66,7 +66,7 @@ jobs:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
win64-st-autotest/debug:
description: "Win64 Debug Static Analysis Autotest"

Просмотреть файл

@ -166,7 +166,7 @@ linux64-clang-trunk:
- linux64-binutils
- linux64-gcc-7
- linux64-toolchain-sysroot
- wasi-sysroot
- wasm32-wasi-compiler-rt
linux64-clang-11-android-cross:
description: "Clang 11 toolchain build"
@ -384,7 +384,7 @@ linux64-clang-12:
- linux64-binutils
- linux64-gcc-7
- linux64-toolchain-sysroot
- wasi-sysroot-12
- wasm32-wasi-compiler-rt-12
linux64-clang-12-android-cross:
description: "Clang 12 toolchain build"
@ -502,7 +502,7 @@ macosx64-clang-12:
- linux64-clang-12-macosx-cross
- linux64-gcc-7
- macosx64-sdk-10.12
- wasi-sysroot-12
- wasm32-wasi-compiler-rt-12
macosx64-aarch64-clang-12:
description: "Clang 12 toolchain build"
@ -534,7 +534,7 @@ macosx64-aarch64-clang-12:
- linux64-clang-12-macosx-cross
- linux64-gcc-7
- macosx64-sdk-11.0
- wasi-sysroot-12
- wasm32-wasi-compiler-rt-12
win64-clang-12:
description: "Clang-cl 12 toolchain build"
@ -565,7 +565,7 @@ win64-clang-12:
- cmake
- ninja
toolchain:
- wasi-sysroot-12
- wasm32-wasi-compiler-rt-12
win64-clang-12-2stage:
description: "Clang-cl 12 toolchain 2-stage quick build"

Просмотреть файл

@ -106,3 +106,16 @@ macosx64-aarch64-compiler-rt-12:
- linux64-cctools-port-clang-12
- linux64-clang-12
- macosx64-sdk-11.0
wasm32-wasi-compiler-rt-12:
description: "wasm32-wasi Compiler-rt for Clang 12 toolchain build"
treeherder:
symbol: TL(wasi-crt-12)
worker-type: b-linux-xlarge
run:
script: build-compiler-rt-wasi.sh
toolchain-alias: wasm32-wasi-compiler-rt
fetches:
fetch:
- clang-12
- wasi-sdk

Просмотреть файл

@ -181,27 +181,6 @@ browsertime:
toolchain:
- linux64-node
wasi-sysroot-12:
description: "wasi sysroot build using clang-12"
attributes:
local-toolchain: true
treeherder:
symbol: TL(wasi-sysroot-12)
worker-type: b-linux-xlarge
run-on-projects: [trunk]
run:
script: build-wasi-sysroot.sh
sparse-profile: null
toolchain-alias: wasi-sysroot
toolchain-artifact: public/build/wasi-sysroot.tar.xz
fetches:
fetch:
- clang-12
- wasi-sdk
toolchain:
- linux64-binutils
- linux64-gcc-7
wrench-deps:
description: "Downloads all the crates needed for building wrench"
treeherder:

Просмотреть файл

@ -63,6 +63,23 @@ sysroot-x86_64-linux-gnu-x11:
arguments:
- amd64
sysroot-wasm32-wasi:
description: "Sysroot for wasi"
attributes:
local-toolchain: true
run-on-projects: [trunk]
treeherder:
symbol: TL(sysroot-wasi)
run:
script: build-sysroot-wasi.sh
toolchain-artifact: public/build/sysroot-wasm32-wasi.tar.zst
fetches:
fetch:
- clang-12
- wasi-sdk
toolchain:
- linux64-clang-12
sysroot-aarch64-linux-gnu:
description: "Sysroot for linux64 aarch64 builds"
attributes:

Просмотреть файл

@ -59,6 +59,6 @@ jobs:
- linux64-nasm
- linux64-node
- sysroot-x86_64-linux-gnu
- wasi-sysroot
- sysroot-wasm32-wasi
optimization:
skip-unless-expanded: null

Просмотреть файл

@ -0,0 +1,38 @@
#!/bin/bash
set -x -e -v
artifact=$(basename $TOOLCHAIN_ARTIFACT)
dir=${artifact%.tar.*}
cd $MOZ_FETCHES_DIR/wasi-sdk
LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project
# https://github.com/WebAssembly/wasi-sdk/pull/189
patch -p1 <<'EOF'
diff --git a/Makefile b/Makefile
index bde9936..b1f24fe 100644
--- a/Makefile
+++ b/Makefile
@@ -91,7 +91,7 @@ build/wasi-libc.BUILT: build/llvm.BUILT
SYSROOT=$(BUILD_PREFIX)/share/wasi-sysroot
touch build/wasi-libc.BUILT
-build/compiler-rt.BUILT: build/llvm.BUILT
+build/compiler-rt.BUILT: build/llvm.BUILT build/wasi-libc.BUILT
# Do the build, and install it.
mkdir -p build/compiler-rt
cd build/compiler-rt && cmake -G Ninja \
EOF
# Build compiler-rt
make \
LLVM_PROJ_DIR=$LLVM_PROJ_DIR \
PREFIX=/wasi \
build/compiler-rt.BUILT \
-j$(nproc)
mkdir -p $dir/lib
mv build/install/wasi/lib/clang/*/lib/wasi $dir/lib
tar --zstd -cf $artifact $dir
mkdir -p $UPLOAD_DIR
mv $artifact $UPLOAD_DIR/

Просмотреть файл

@ -0,0 +1,37 @@
#!/bin/bash
set -x -e -v
artifact=$(basename $TOOLCHAIN_ARTIFACT)
sysroot=${artifact%.tar.*}
cd $MOZ_FETCHES_DIR/wasi-sdk
LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project
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.
ln -s $MOZ_FETCHES_DIR/clang build/llvm
touch build/llvm.BUILT
# The wasi-sdk build system has a dependency on compiler-rt for libcxxabi,
# but that's not actually necessary. Pretend it's already built
touch build/compiler-rt.BUILT
# The wasi-sdk build system wants a clang and an ar binary in
# build/install/$PREFIX/bin
ln -s $MOZ_FETCHES_DIR/clang/bin build/install/wasi/bin
ln -s llvm-ar build/install/wasi/bin/ar
# Build wasi-libc, libc++ and libc++abi.
make \
LLVM_PROJ_DIR=$LLVM_PROJ_DIR \
PREFIX=/wasi \
build/wasi-libc.BUILT \
build/libcxx.BUILT \
build/libcxxabi.BUILT \
-j$(nproc)
mv build/install/wasi/share/wasi-sysroot $sysroot
tar --zstd -cf $artifact $sysroot
mkdir -p $UPLOAD_DIR
mv $artifact $UPLOAD_DIR/

Просмотреть файл

@ -1,12 +0,0 @@
#!/bin/bash
set -x -e -v
export PATH="$MOZ_FETCHES_DIR/gcc/bin:$MOZ_FETCHES_DIR/binutils/bin:$PATH"
export LD_LIBRARY_PATH="$MOZ_FETCHES_DIR/gcc/lib64/:$LD_LIBRARY_PATH"
cd $MOZ_FETCHES_DIR/wasi-sdk
PREFIX=$MOZ_FETCHES_DIR/wasi-sdk/wasi-sysroot
LLVM_PROJ_DIR=$MOZ_FETCHES_DIR/llvm-project
make LLVM_PROJ_DIR=$LLVM_PROJ_DIR PREFIX=$PREFIX
# Put a tarball in the artifacts dir
mkdir -p $UPLOAD_DIR
tar -C $MOZ_FETCHES_DIR/wasi-sdk/build/install/$PREFIX/../ -caf $UPLOAD_DIR/wasi-sysroot.tar.xz wasi-sysroot/{lib,share}

Просмотреть файл

@ -2099,7 +2099,7 @@ with only_when(requires_wasm_sandboxing & compile_environment):
@depends(
"--with-wasi-sysroot",
bootstrap_path("wasi-sysroot/share/wasi-sysroot", when=bootstrap_wasi_sysroot),
bootstrap_path("sysroot-wasm32-wasi", when=bootstrap_wasi_sysroot),
)
@imports("os")
def wasi_sysroot(wasi_sysroot, bootstrapped_sysroot):