Bug 1755415 - Encode the target in the compiler-rt artifact/directory. r=firefox-build-system-reviewers,mhentges

This simplifies the setup for cross clang repacks.

Also use `ninja install` to get all the relevant things in the artifact.

Differential Revision: https://phabricator.services.mozilla.com/D138745
This commit is contained in:
Mike Hommey 2022-02-16 08:24:39 +00:00
Родитель 37fcdf3f08
Коммит aaf5a314c5
9 изменённых файлов: 51 добавлений и 114 удалений

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

@ -3,5 +3,5 @@
"cc": "/usr/lib/llvm-11/bin/clang",
"cxx": "/usr/lib/llvm-11/bin/clang++",
"as": "/usr/lib/llvm-11/bin/clang",
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt"
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt-wasm32-wasi"
}

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

@ -8,5 +8,5 @@
"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-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt"
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt-wasm32-wasi"
}

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

@ -3,5 +3,5 @@
"cc": "cl.exe",
"cxx": "cl.exe",
"ml": "ml64.exe",
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt"
"wasi-compiler-rt": "{MOZ_FETCHES_DIR}/compiler-rt-wasm32-wasi"
}

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

@ -190,33 +190,15 @@ linux64-clang-13-android-cross:
run:
using: toolchain-script
script: repack-clang-linux-cross.sh
arguments:
- aarch64
- arm
- x86
- x64
toolchain-alias: linux64-clang-android-cross
toolchain-artifact: public/build/clang.tar.zst
dependencies:
android-aarch64-compiler-rt-13: toolchain-android-aarch64-compiler-rt-13
android-arm-compiler-rt-13: toolchain-android-arm-compiler-rt-13
android-x86-compiler-rt-13: toolchain-android-x86-compiler-rt-13
android-x64-compiler-rt-13: toolchain-android-x64-compiler-rt-13
fetches:
toolchain:
- linux64-clang-13
android-aarch64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: aarch64
android-arm-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: arm
android-x86-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86
android-x64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x64
- android-aarch64-compiler-rt-13
- android-arm-compiler-rt-13
- android-x86-compiler-rt-13
- android-x64-compiler-rt-13
linux64-clang-13-aarch64-cross:
description: "Clang 13 toolchain build with aarch64 runtime"
@ -229,13 +211,10 @@ linux64-clang-13-aarch64-cross:
script: repack-clang-linux-cross.sh
toolchain-alias: linux64-clang-aarch64-cross
toolchain-artifact: public/build/clang.tar.zst
dependencies:
linux64-aarch64-compiler-rt-13: toolchain-linux64-aarch64-compiler-rt-13
fetches:
toolchain:
- linux64-clang-13
linux64-aarch64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
- linux64-aarch64-compiler-rt-13
linux64-clang-13-macosx-cross:
description: "Clang 13 toolchain repack with MacOS Compiler RT libs"
@ -248,19 +227,12 @@ linux64-clang-13-macosx-cross:
script: repack-clang-linux-macosx-cross.sh
toolchain-alias: linux64-clang-macosx-cross
toolchain-artifact: public/build/clang.tar.zst
dependencies:
macosx64-aarch64-compiler-rt-13: toolchain-macosx64-aarch64-compiler-rt-13
macosx64-x64-compiler-rt-13: toolchain-macosx64-x64-compiler-rt-13
fetches:
toolchain:
- linux64-cctools-port
- linux64-clang-13
macosx64-aarch64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: aarch64
macosx64-x64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86_64
- macosx64-aarch64-compiler-rt-13
- macosx64-x64-compiler-rt-13
linux64-clang-13-win-cross:
description: "Clang 13 toolchain repack with Windows Compiler RT libs"
@ -273,18 +245,11 @@ linux64-clang-13-win-cross:
script: repack-clang-linux-win-cross.sh
toolchain-alias: linux64-clang-win-cross
toolchain-artifact: public/build/clang.tar.zst
dependencies:
win32-compiler-rt-13: toolchain-win32-compiler-rt-13
win64-compiler-rt-13: toolchain-win64-compiler-rt-13
fetches:
toolchain:
- linux64-clang-13
win32-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86
win64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86_64
- win32-compiler-rt-13
- win64-compiler-rt-13
macosx64-clang-13-raw:
description: "Clang 13 toolchain build"
@ -333,19 +298,12 @@ macosx64-clang-13:
- macosx64-clang
- macosx64-clang-toolchain
toolchain-artifact: public/build/clang.tar.zst
dependencies:
macosx64-aarch64-compiler-rt-13: toolchain-macosx64-aarch64-compiler-rt-13
macosx64-x64-compiler-rt-13: toolchain-macosx64-x64-compiler-rt-13
fetches:
toolchain:
- linux64-cctools-port
- macosx64-clang-13-raw
macosx64-aarch64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: aarch64
macosx64-x64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86_64
- macosx64-aarch64-compiler-rt-13
- macosx64-x64-compiler-rt-13
macosx64-aarch64-clang-13-raw:
description: "Clang 13 toolchain build"
@ -394,19 +352,12 @@ macosx64-aarch64-clang-13:
script: repack-clang-linux-macosx-cross.sh
toolchain-alias: macosx64-aarch64-clang
toolchain-artifact: public/build/clang.tar.zst
dependencies:
macosx64-aarch64-compiler-rt-13: toolchain-macosx64-aarch64-compiler-rt-13
macosx64-x64-compiler-rt-13: toolchain-macosx64-x64-compiler-rt-13
fetches:
toolchain:
- linux64-cctools-port
- macosx64-aarch64-clang-13-raw
macosx64-aarch64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: aarch64
macosx64-x64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86_64
- macosx64-aarch64-compiler-rt-13
- macosx64-x64-compiler-rt-13
win64-clang-13-raw:
description: "Clang-cl 13 toolchain build"
@ -456,18 +407,11 @@ win64-clang-13:
script: repack-clang-linux-win-cross.sh
toolchain-alias: win64-clang
toolchain-artifact: public/build/clang.tar.zst
dependencies:
win32-compiler-rt-13: toolchain-win32-compiler-rt-13
win64-compiler-rt-13: toolchain-win64-compiler-rt-13
fetches:
toolchain:
- win64-clang-13-raw
win32-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86
win64-compiler-rt-13:
- artifact: compiler-rt.tar.zst
dest: x86_64
- win32-compiler-rt-13
- win64-compiler-rt-13
win64-clang-13-stage1:
description: "Clang-cl 13 toolchain build stage 1"

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

@ -9,7 +9,6 @@ job-defaults:
run:
using: toolchain-script
script: build-compiler-rt.sh
toolchain-artifact: public/build/compiler-rt.tar.zst
android-aarch64-compiler-rt-13:
description: "android aarch64 Compiler-rt for Clang 13 toolchain build"
@ -17,10 +16,10 @@ android-aarch64-compiler-rt-13:
symbol: TA(aarch64-crt-13)
run:
arguments:
- aarch64-linux-android
- build/build-clang/clang-13.json
resources:
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-aarch64-linux-android.tar.zst
fetches:
fetch:
- clang-13
@ -34,10 +33,10 @@ android-arm-compiler-rt-13:
symbol: TA(arm-crt-13)
run:
arguments:
- armv7-linux-android
- build/build-clang/clang-13.json
resources:
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-armv7-linux-android.tar.zst
fetches:
fetch:
- clang-13
@ -51,10 +50,10 @@ android-x86-compiler-rt-13:
symbol: TA(x86-crt-13)
run:
arguments:
- i686-linux-android
- build/build-clang/clang-13.json
resources:
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-i686-linux-android.tar.zst
fetches:
fetch:
- clang-13
@ -68,10 +67,10 @@ android-x64-compiler-rt-13:
symbol: TA(x64-crt-13)
run:
arguments:
- x86_64-linux-android
- build/build-clang/clang-13.json
resources:
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-x86_64-linux-android.tar.zst
fetches:
fetch:
- clang-13
@ -85,10 +84,10 @@ linux64-aarch64-compiler-rt-13:
symbol: TL(aarch64-crt-13)
run:
arguments:
- aarch64-unknown-linux-gnu
- build/build-clang/clang-13.json
resources:
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-aarch64-unknown-linux-gnu.tar.zst
fetches:
fetch:
- clang-13
@ -103,10 +102,10 @@ macosx64-x64-compiler-rt-13:
symbol: TM(x64-crt-13)
run:
arguments:
- x86_64-apple-darwin
- build/build-clang/clang-13.json
resources:
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-x86_64-apple-darwin.tar.zst
fetches:
fetch:
- clang-13
@ -121,10 +120,10 @@ macosx64-aarch64-compiler-rt-13:
symbol: TM(aarch64-crt-13)
run:
arguments:
- aarch64-apple-darwin
- build/build-clang/clang-13.json
resources:
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-aarch64-apple-darwin.tar.zst
fetches:
fetch:
- clang-13
@ -142,11 +141,11 @@ win32-compiler-rt-13:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/vs2017-15.9.manifest"
run:
arguments:
- i686-pc-windows-msvc
- build/build-clang/clang-13.json
resources:
- 'taskcluster/scripts/misc/tooltool-download.sh'
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-i686-pc-windows-msvc.tar.zst
tooltool-downloads: internal
fetches:
fetch:
@ -164,11 +163,11 @@ win64-compiler-rt-13:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/vs2017-15.9.manifest"
run:
arguments:
- x86_64-pc-windows-msvc
- build/build-clang/clang-13.json
resources:
- 'taskcluster/scripts/misc/tooltool-download.sh'
- build/build-clang/clang-13.json
toolchain-artifact: public/build/compiler-rt-x86_64-pc-windows-msvc.tar.zst
tooltool-downloads: internal
fetches:
fetch:
@ -184,6 +183,7 @@ wasm32-wasi-compiler-rt-13:
worker-type: b-linux-xlarge
run:
script: build-compiler-rt-wasi.sh
toolchain-artifact: public/build/compiler-rt-wasm32-wasi.tar.zst
toolchain-alias: wasm32-wasi-compiler-rt
fetches:
fetch:

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

@ -2,8 +2,9 @@
set -e -x
target=$1
shift
artifact=$(basename $TOOLCHAIN_ARTIFACT)
dir=${artifact%.tar.*}
target=${dir#compiler-rt-}
clang=$MOZ_FETCHES_DIR/clang/bin/clang
@ -51,7 +52,6 @@ esac
case "$target" in
*-apple-darwin)
libdir=lib/darwin
EXTRA_CMAKE_FLAGS="
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/cctools/bin/$target-ld
-DCMAKE_LIPO=$MOZ_FETCHES_DIR/cctools/bin/lipo
@ -71,7 +71,6 @@ case "$target" in
PATH="$PWD:$MOZ_FETCHES_DIR/cctools/bin:$PATH"
;;
*-linux-android)
libdir=lib/linux
cflags="
--gcc-toolchain=$MOZ_FETCHES_DIR/android-ndk/toolchains/$ndk_prefix-4.9/prebuilt/linux-x86_64
-isystem $MOZ_FETCHES_DIR/android-ndk/sysroot/usr/include/$ndk_target
@ -101,7 +100,6 @@ case "$target" in
"
;;
aarch64-unknown-linux-gnu)
libdir=lib/linux
EXTRA_CMAKE_FLAGS="
-DCMAKE_SYSROOT=$MOZ_FETCHES_DIR/sysroot-aarch64-linux-gnu
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/clang/bin/ld.lld
@ -177,16 +175,15 @@ eval cmake \
-DCMAKE_AR=$MOZ_FETCHES_DIR/clang/bin/llvm-${ar:-ar} \
-DCMAKE_RANLIB=$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PWD}/${dir} \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_CONFIG_PATH=$MOZ_FETCHES_DIR/clang/bin/llvm-config \
-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON \
$EXTRA_CMAKE_FLAGS
ninja -v
ninja install -v
cd ..
tar caf compiler-rt.tar.zst compiler-rt/$libdir
tar caf "$artifact" "$dir"
mkdir -p "$UPLOAD_DIR"
mv "compiler-rt.tar.zst" "$UPLOAD_DIR"
mv "$artifact" "$UPLOAD_DIR"

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

@ -6,14 +6,10 @@ set -x -e -v
cd $MOZ_FETCHES_DIR
# We have a native linux64 toolchain in $MOZ_FETCHES_DIR/clang
# We have some linux compiler-rts in $MOZ_FETCHES_DIR/compiler-rt if no argument
# is given to the script, or $MOZ_FETCHES_DIR/*/compiler-rt otherwise. The
# subdirectories are given as arguments.
# We have some linux compiler-rts in $MOZ_FETCHES_DIR/compiler-rt*
clang_lib=$(echo $PWD/clang/lib/clang/*/lib)
for dir in ${*:-.}; do
find $dir/compiler-rt/lib/linux -type f | while read f; do
cp -n $f $clang_lib/linux
done
find compiler-rt-*/lib/linux -type f | while read f; do
cp -n $f $clang_lib/linux
done
tar -caf clang.tar.zst clang

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

@ -7,20 +7,20 @@ set -x -e -v
cd $MOZ_FETCHES_DIR
# We have a native linux64 toolchain in $MOZ_FETCHES_DIR/clang
# We have a native aarch64 macos compiler-rt in $MOZ_FETCHES_DIR/aarch64/compiler-rt
# We have a native x86_64 macos compiler-rt in $MOZ_FETCHES_DIR/x86_64/compiler-rt
# We have a native aarch64 macos compiler-rt in $MOZ_FETCHES_DIR/compiler-rt-aarch64-apple-darwin
# We have a native x86_64 macos compiler-rt in $MOZ_FETCHES_DIR/compiler-rt-x86_64-apple-darwin
clang_lib=$(echo clang/lib/clang/*/lib)
mkdir -p $clang_lib/darwin
find {aarch64,x86_64}/compiler-rt/lib/darwin -type f -printf '%f\n' | sort -u | while read f; do
f=compiler-rt/lib/darwin/$f
if [ -f aarch64/$f -a -f x86_64/$f ]; then
find compiler-rt-*/lib/darwin -type f -printf '%f\n' | sort -u | while read f; do
f=lib/darwin/$f
if [ -f compiler-rt-aarch64-apple-darwin/$f -a -f compiler-rt-x86_64-apple-darwin/$f ]; then
# For compiler-rt files that exist on both ends, merge them
$MOZ_FETCHES_DIR/cctools/bin/lipo -create {aarch64,x86_64}/$f -output $clang_lib/darwin/${f##*/}
elif [ -f aarch64/$f ]; then
$MOZ_FETCHES_DIR/cctools/bin/lipo -create compiler-rt-{aarch64,x86_64}-apple-darwin/$f -output $clang_lib/darwin/${f##*/}
elif [ -f compiler-rt-aarch64-apple-darwin/$f ]; then
# For compiler-rt files that exist on either end, copy the existing one
cp aarch64/$f $clang_lib/darwin
cp compiler-rt-aarch64-apple-darwin/$f $clang_lib/darwin
else
cp x86_64/$f $clang_lib/darwin
cp compiler-rt-x86_64-apple-darwin/$f $clang_lib/darwin
fi
done

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

@ -7,12 +7,12 @@ set -x -e -v
cd $MOZ_FETCHES_DIR
# We have a native linux64 toolchain in $MOZ_FETCHES_DIR/clang
# We have a native x86 windows compiler-rt in $MOZ_FETCHES_DIR/x86/compiler-rt
# We have a native x86_64 windows compiler-rt in $MOZ_FETCHES_DIR/x86_64/compiler-rt
# We have a native x86 windows compiler-rt in $MOZ_FETCHES_DIR/compiler-rt-i686-pc-windows-msvc
# We have a native x86_64 windows compiler-rt in $MOZ_FETCHES_DIR/compiler-rt-x86_64-pc-windows-msvc
clang_lib=$(echo clang/lib/clang/*/lib)
mkdir -p $clang_lib/windows
cp x86/compiler-rt/lib/windows/* $clang_lib/windows
cp x86_64/compiler-rt/lib/windows/* $clang_lib/windows
cp compiler-rt-i686-pc-windows-msvc/lib/windows/* $clang_lib/windows
cp compiler-rt-x86_64-pc-windows-msvc/lib/windows/* $clang_lib/windows
tar caf clang.tar.zst clang