From adaf88ed516407af47dee3bafc3f4f5c0b888195 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 11 Mar 2022 04:10:48 +0000 Subject: [PATCH] Bug 1758781 - Use the WinMsvc.cmake toolchain file to build compiler-rt. r=firefox-build-system-reviewers,mhentges The toolchain file is a helper for cross-compilation that even deals with case-sensivity in MSVC, which simplifies our setup. Differential Revision: https://phabricator.services.mozilla.com/D140710 --- taskcluster/ci/toolchain/compiler-rt.yml | 2 - taskcluster/scripts/misc/build-compiler-rt.sh | 52 +++++++------------ 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/taskcluster/ci/toolchain/compiler-rt.yml b/taskcluster/ci/toolchain/compiler-rt.yml index 68eb4c87da99..184e4ad172d9 100644 --- a/taskcluster/ci/toolchain/compiler-rt.yml +++ b/taskcluster/ci/toolchain/compiler-rt.yml @@ -183,7 +183,6 @@ win32-compiler-rt-13: - clang-13 toolchain: - linux64-clang-13-stage1 - - linux64-liblowercase win64-compiler-rt-13: description: "win64 x64 Compiler-rt for Clang 13 toolchain build" @@ -205,7 +204,6 @@ win64-compiler-rt-13: - clang-13 toolchain: - linux64-clang-13-stage1 - - linux64-liblowercase wasm32-wasi-compiler-rt-13: description: "wasm32-wasi Compiler-rt for Clang 13 toolchain build" diff --git a/taskcluster/scripts/misc/build-compiler-rt.sh b/taskcluster/scripts/misc/build-compiler-rt.sh index cec673f9b604..7ba78503cdfe 100755 --- a/taskcluster/scripts/misc/build-compiler-rt.sh +++ b/taskcluster/scripts/misc/build-compiler-rt.sh @@ -109,35 +109,13 @@ case "$target" in " ;; *-pc-windows-msvc) - VSPATH="$MOZ_FETCHES_DIR/vs2017_15.9.6" - SDK_VERSION=10.0.17134.0 - - export INCLUDE="${VSPATH}/VC/include;${VSPATH}/VC/atlmfc/include;${VSPATH}/SDK/Include/${SDK_VERSION}/ucrt;${VSPATH}/SDK/Include/${SDK_VERSION}/shared;${VSPATH}/SDK/Include/${SDK_VERSION}/um" - case "$target" in - i686-pc-windows-msvc) - VCARCH=x86 - ;; - x86_64-pc-windows-msvc) - VCARCH=x64 - ;; - aarch64-pc-windows-msvc) - VCARCH=arm64 - ;; - esac - export LIB="${VSPATH}/VC/lib/${VCARCH};${VSPATH}/VC/atlmfc/lib/${VCARCH};${VSPATH}/SDK/Lib/${SDK_VERSION}/um/${VCARCH};${VSPATH}/SDK/Lib/${SDK_VERSION}/ucrt/${VCARCH}" - export LD_PRELOAD=$MOZ_FETCHES_DIR/liblowercase/liblowercase.so - export LOWERCASE_DIRS=$VSPATH - clang=$MOZ_FETCHES_DIR/clang/bin/clang-cl - clangxx=$clang - ar=lib EXTRA_CMAKE_FLAGS=" - -DCMAKE_SYSTEM_NAME=Windows - -DCMAKE_LINKER=$MOZ_FETCHES_DIR/clang/bin/lld-link - -DCMAKE_MT=$MOZ_FETCHES_DIR/clang/bin/llvm-mt - -DCMAKE_RC_COMPILER=$MOZ_FETCHES_DIR/clang/bin/llvm-rc - -DCMAKE_C_FLAGS='--target=$target -fms-compatibility-version=19.15.26726' - -DCMAKE_CXX_FLAGS='--target=$target -fms-compatibility-version=19.15.26726' - -DCMAKE_ASM_FLAGS=--target=$target + -DCMAKE_TOOLCHAIN_FILE=$MOZ_FETCHES_DIR/llvm-project/llvm/cmake/platforms/WinMsvc.cmake + -DLLVM_NATIVE_TOOLCHAIN=$MOZ_FETCHES_DIR/clang + -DMSVC_BASE=$MOZ_FETCHES_DIR/vs2017_15.9.6/VC + -DWINSDK_BASE=$MOZ_FETCHES_DIR/vs2017_15.9.6/SDK + -DWINSDK_VER=10.0.17134.0 + -DHOST_ARCH=${target%-pc-windows-msvc} " ;; *) @@ -146,6 +124,20 @@ case "$target" in ;; esac +case "$target" in +*-pc-windows-msvc) + ;; +*) + EXTRA_CMAKE_FLAGS=" + $EXTRA_CMAKE_FLAGS + -DCMAKE_C_COMPILER=$clang + -DCMAKE_CXX_COMPILER=$clang++ + -DCMAKE_AR=$MOZ_FETCHES_DIR/clang/bin/llvm-ar + -DCMAKE_RANLIB=$MOZ_FETCHES_DIR/clang/bin/llvm-ranlib + " + ;; +esac + if [ -n "$TOOLTOOL_MANIFEST" ]; then . $GECKO_PATH/taskcluster/scripts/misc/tooltool-download.sh fi @@ -169,13 +161,9 @@ done eval cmake \ $MOZ_FETCHES_DIR/llvm-project/compiler-rt \ -GNinja \ - -DCMAKE_C_COMPILER=$clang \ - -DCMAKE_CXX_COMPILER=${clangxx:-$clang++} \ -DCMAKE_C_COMPILER_TARGET=$target \ -DCMAKE_CXX_COMPILER_TARGET=$target \ -DCMAKE_ASM_COMPILER_TARGET=$target \ - -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 \