Skip to content

Commit

Permalink
Bug 1678154 - Build compiler-rt for aarch64 macos. r=firefox-build-sy…
Browse files Browse the repository at this point in the history
…stem-reviewers,dmajor

Differential Revision: https://phabricator.services.mozilla.com/D97696
  • Loading branch information
glandium committed Nov 20, 2020
1 parent 5be8092 commit f48bc80
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
18 changes: 18 additions & 0 deletions taskcluster/ci/toolchain/misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,21 @@ macosx64-sdk-11.0:
toolchain-artifact: project/gecko/mac-sdk/MacOSX11.0.sdk.tar.zst
# Expiry similar to that of fetches
expires-after: 1000 years

macosx64-aarch64-compiler-rt-11:
description: "macOS aarch64 Compiler-rt for Clang 11 toolchain build"
treeherder:
symbol: TM(aarch64-crt)
run:
using: toolchain-script
script: build-compiler-rt.sh
arguments:
- aarch64-apple-darwin
toolchain-artifact: public/build/compiler-rt.tar.zst
fetches:
fetch:
- clang-11
toolchain:
- linux64-cctools-port-clang-11
- linux64-clang-11-macosx-cross
- macosx64-sdk-11.0
43 changes: 43 additions & 0 deletions taskcluster/scripts/misc/build-compiler-rt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

set -e

[ "$1" != "aarch64-apple-darwin" ] && echo $1 is not supported yet && exit 1

mkdir compiler-rt
cd compiler-rt

cmake \
$MOZ_FETCHES_DIR/llvm-project/compiler-rt \
-GNinja \
-DCMAKE_C_COMPILER=$MOZ_FETCHES_DIR/clang/bin/clang \
-DCMAKE_CXX_COMPILER=$MOZ_FETCHES_DIR/clang/bin/clang++ \
-DCMAKE_LINKER=$MOZ_FETCHES_DIR/cctools/bin/aarch64-apple-darwin-ld \
-DCMAKE_LIPO=$MOZ_FETCHES_DIR/cctools/bin/lipo \
-DCMAKE_AR=$MOZ_FETCHES_DIR/cctools/bin/aarch64-apple-darwin-ar \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_CONFIG_PATH=$MOZ_FETCHES_DIR/clang/bin/llvm-config \
-DCMAKE_C_FLAGS="-target aarch64-apple-darwin -mcpu=apple-a12 -B $MOZ_FETCHES_DIR/cctools/bin -isysroot $MOZ_FETCHES_DIR/MacOSX11.0.sdk" \
-DCMAKE_CXX_FLAGS="-target aarch64-apple-darwin -mcpu=apple-a12 -B $MOZ_FETCHES_DIR/cctools/bin -isysroot $MOZ_FETCHES_DIR/MacOSX11.0.sdk" \
-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

# compiler-rt build script expects to find `codesign` in $PATH.
# Give it a fake one.
echo "#!/bin/sh" > codesign
chmod +x codesign

PATH=$PATH:$PWD ninja

cd ..

tar -cf - compiler-rt/lib/darwin | python3 $GECKO_PATH/taskcluster/scripts/misc/zstdpy > "compiler-rt.tar.zst"

mkdir -p "$UPLOAD_DIR"
mv "compiler-rt.tar.zst" "$UPLOAD_DIR"

0 comments on commit f48bc80

Please sign in to comment.