diff --git a/taskcluster/ci/config.yml b/taskcluster/ci/config.yml index 98c5b3accac2..96d2fb786af9 100644 --- a/taskcluster/ci/config.yml +++ b/taskcluster/ci/config.yml @@ -122,6 +122,7 @@ treeherder: 'Ub18': 'Packages for Ubuntu 18.04' 'Ub20': 'Packages for Ubuntu 20.04' 'I': 'Docker Image Builds' + 'TA': 'Toolchain builds for Android' 'TL': 'Toolchain builds for Linux 64-bits' 'TL32': 'Toolchain builds for Linux 32-bits' 'TM': 'Toolchain builds for OSX' diff --git a/taskcluster/ci/toolchain/compiler-rt.yml b/taskcluster/ci/toolchain/compiler-rt.yml index 1736070de9a4..dc0b062d7c8e 100644 --- a/taskcluster/ci/toolchain/compiler-rt.yml +++ b/taskcluster/ci/toolchain/compiler-rt.yml @@ -11,6 +11,74 @@ job-defaults: script: build-compiler-rt.sh toolchain-artifact: public/build/compiler-rt.tar.zst +android-aarch64-compiler-rt-12: + description: "android aarch64 Compiler-rt for Clang 12 toolchain build" + treeherder: + symbol: TA(aarch64-crt-12) + run: + arguments: + - aarch64-linux-android + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + resources: + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + fetches: + fetch: + - clang-12 + toolchain: + - linux64-clang-12 + - linux64-android-ndk-linux-repack + +android-arm-compiler-rt-12: + description: "android arm Compiler-rt for Clang 12 toolchain build" + treeherder: + symbol: TA(arm-crt-12) + run: + arguments: + - armv7-linux-android + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + resources: + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + fetches: + fetch: + - clang-12 + toolchain: + - linux64-clang-12 + - linux64-android-ndk-linux-repack + +android-x86-compiler-rt-12: + description: "android x86 Compiler-rt for Clang 12 toolchain build" + treeherder: + symbol: TA(x86-crt-12) + run: + arguments: + - i686-linux-android + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + resources: + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + fetches: + fetch: + - clang-12 + toolchain: + - linux64-clang-12 + - linux64-android-ndk-linux-repack + +android-x64-compiler-rt-12: + description: "android x64 Compiler-rt for Clang 12 toolchain build" + treeherder: + symbol: TA(x64-crt-12) + run: + arguments: + - x86_64-linux-android + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + resources: + - 'build/build-clang/find_symbolizer_linux_clang_10.patch' + fetches: + fetch: + - clang-12 + toolchain: + - linux64-clang-12 + - linux64-android-ndk-linux-repack + linux64-aarch64-compiler-rt-12: description: "Linux aarch64 Compiler-rt for Clang 12 toolchain build" treeherder: diff --git a/taskcluster/scripts/misc/build-compiler-rt.sh b/taskcluster/scripts/misc/build-compiler-rt.sh index 8dda83261443..e1aaf0b8284e 100755 --- a/taskcluster/scripts/misc/build-compiler-rt.sh +++ b/taskcluster/scripts/misc/build-compiler-rt.sh @@ -23,6 +23,30 @@ x86_64-apple-darwin) arch=x86_64 export MACOSX_DEPLOYMENT_TARGET=10.12 ;; +armv7-linux-android) + api_level=16 + ndk_target=arm-linux-androideabi + ndk_prefix=arm-linux-androideabi + ndk_arch=arm + ;; +aarch64-linux-android) + api_level=21 + ndk_target=aarch64-linux-android + ndk_prefix=aarch64-linux-android + ndk_arch=arm64 + ;; +i686-linux-android) + api_level=16 + ndk_target=i686-linux-android + ndk_prefix=x86 + ndk_arch=x86 + ;; +x86_64-linux-android) + api_level=21 + ndk_target=x86_64-linux-android + ndk_prefix=x86_64 + ndk_arch=x86_64 + ;; esac case "$target" in @@ -45,6 +69,34 @@ case "$target" in chmod +x codesign 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 + -isystem $MOZ_FETCHES_DIR/android-ndk/sysroot/usr/include + -D__ANDROID_API__=$api_level + " + # These flags are only necessary to pass the cmake tests. + exe_linker_flags=" + -L$MOZ_FETCHES_DIR/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$ndk_target/$api_level + -L$MOZ_FETCHES_DIR/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/$ndk_target + " + EXTRA_CMAKE_FLAGS=" + -DCMAKE_SYSROOT=$MOZ_FETCHES_DIR/android-ndk/platforms/android-$api_level/arch-$ndk_arch + -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld + -DCMAKE_LINKER=$MOZ_FETCHES_DIR/clang/bin/ld.lld + -DCMAKE_C_FLAGS='-fPIC $cflags' + -DCMAKE_ASM_FLAGS='$cflags' + -DCMAKE_CXX_FLAGS='-fPIC -Qunused-arguments $cflags' + -DCMAKE_EXE_LINKER_FLAGS='-fuse-ld=lld $exe_linker_flags' + -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld + -DANDROID=1 + -DANDROID_NATIVE_API_LEVEL=$api_level + -DSANITIZER_ALLOW_CXXABI=OFF + -DCOMPILER_RT_BUILD_LIBFUZZER=OFF + " + ;; aarch64-unknown-linux-gnu) libdir=lib/linux EXTRA_CMAKE_FLAGS=" @@ -70,7 +122,7 @@ for patchfile in "$@"; do patch -d $MOZ_FETCHES_DIR/llvm-project -p1 < $GECKO_PATH/$patchfile done -cmake \ +eval cmake \ $MOZ_FETCHES_DIR/llvm-project/compiler-rt \ -GNinja \ -DCMAKE_C_COMPILER=$clang \