Bug 1685599 - Build a compiler-rt for x86_64. r=firefox-build-system-reviewers,mhentges

The llvm build system does support building a universal compiler-rt for
multiple platforms at once, but as far as I know it only supports doing
so with the same SDK, while we want to use separate SDKs for each, so
build the x86_64 compiler-rt separately.

Differential Revision: https://phabricator.services.mozilla.com/D101078
This commit is contained in:
Mike Hommey 2021-01-08 18:51:52 +00:00
Родитель 533d1be24e
Коммит fd26bcb560
2 изменённых файлов: 52 добавлений и 11 удалений

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

@ -359,6 +359,27 @@ macosx64-sdk-11.0:
# Expiry similar to that of fetches
expires-after: 1000 years
macosx64-x64-compiler-rt-11:
description: "macOS x64 Compiler-rt for Clang 11 toolchain build"
treeherder:
symbol: TM(x64-crt)
worker:
env:
TOOLTOOL_MANIFEST: "browser/config/tooltool-manifests/macosx64/cross-releng.manifest"
run:
using: toolchain-script
script: build-compiler-rt.sh
arguments:
- x86_64-apple-darwin
toolchain-artifact: public/build/compiler-rt.tar.zst
tooltool-downloads: internal
fetches:
fetch:
- clang-11
toolchain:
- linux64-cctools-port-clang-11
- linux64-clang-11
macosx64-aarch64-compiler-rt-11:
description: "macOS aarch64 Compiler-rt for Clang 11 toolchain build"
treeherder:

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

@ -2,16 +2,36 @@
set -e
[ "$1" != "aarch64-apple-darwin" ] && echo $1 is not supported yet && exit 1
target=$1
case "$target" in
aarch64-apple-darwin)
arch=arm64
sdk=11.0
extra_flags="-mcpu=apple-a12"
;;
x86_64-apple-darwin)
arch=x86_64
sdk=10.12
;;
*)
echo $target is not supported yet
exit 1
;;
esac
export PATH="$MOZ_FETCHES_DIR/cctools/bin:$PATH"
if [ -n "$TOOLTOOL_MANIFEST" ]; then
. $GECKO_PATH/taskcluster/scripts/misc/tooltool-download.sh
fi
mkdir compiler-rt
cd compiler-rt
compiler_wrapper() {
cat > $1 <<EOF
exec \$MOZ_FETCHES_DIR/clang/bin/$1 -target aarch64-apple-darwin -mcpu=apple-a12 -isysroot \$MOZ_FETCHES_DIR/MacOSX11.0.sdk "\$@"
exec \$MOZ_FETCHES_DIR/clang/bin/$1 -target $target $extra_flags -isysroot \$MOZ_FETCHES_DIR/MacOSX$sdk.sdk "\$@"
EOF
chmod +x $1
}
@ -23,20 +43,20 @@ cmake \
-GNinja \
-DCMAKE_C_COMPILER=$PWD/clang \
-DCMAKE_CXX_COMPILER=$PWD/clang++ \
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/cctools/bin/aarch64-apple-darwin-ld \
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/cctools/bin/$target-ld \
-DCMAKE_LIPO=$MOZ_FETCHES_DIR/cctools/bin/lipo \
-DCMAKE_AR=$MOZ_FETCHES_DIR/cctools/bin/aarch64-apple-darwin-ar \
-DCMAKE_RANLIB=$MOZ_FETCHES_DIR/cctools/bin/aarch64-apple-darwin-ranlib \
-DCMAKE_AR=$MOZ_FETCHES_DIR/cctools/bin/$target-ar \
-DCMAKE_RANLIB=$MOZ_FETCHES_DIR/cctools/bin/$target-ranlib \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_CONFIG_PATH=$MOZ_FETCHES_DIR/clang/bin/llvm-config \
-DCMAKE_SYSTEM_NAME=Darwin \
-DCMAKE_SYSTEM_VERSION=11.0 \
-DDARWIN_osx_ARCHS=arm64 \
-DDARWIN_osx_SYSROOT=$MOZ_FETCHES_DIR/MacOSX11.0.sdk \
-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-apple-darwin \
-DDARWIN_macosx_OVERRIDE_SDK_VERSION=11.0 \
-DDARWIN_osx_BUILTIN_ARCHS=arm64
-DCMAKE_SYSTEM_VERSION=$sdk \
-DDARWIN_osx_ARCHS=$arch \
-DDARWIN_osx_SYSROOT=$MOZ_FETCHES_DIR/MacOSX$sdk.sdk \
-DLLVM_DEFAULT_TARGET_TRIPLE=$target \
-DDARWIN_macosx_OVERRIDE_SDK_VERSION=$sdk \
-DDARWIN_osx_BUILTIN_ARCHS=$arch
# compiler-rt build script expects to find `codesign` in $PATH.
# Give it a fake one.