From 7dda04a1c9e7c6472047d7f0f30d00463c526a2a Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Thu, 22 Jul 2021 17:26:38 +0700 Subject: [PATCH] [K/N] Update LLVM distributions to 11.1.0 This commit is important for several reasons: 1. Finally, LLVM update from 8.0.0 to 11.1.0 At the time of writing, LLVM 12.0.0 already came out, but we need to be compatible with LLVM from Xcode 12.5, so that's why we stick to a bit older version of LLVM. 2. These LLVM distributions are built with tools/llvm_builder/package.py We finally managed to introduce an explicit process of building our LLVM distributions, so we will be able to updated them more frequently and adapt to our needs. 3. Native Windows LLVM instead of MinGW Last but not least, we now use native Windows LLVM distribution. While it might be harder to use (no more posix everywhere), simpler build process (building msys2 is not that easy) and no need for MinGW-specific patches makes such distribution way more convenient. --- kotlin-native/konan/konan.properties | 41 +++++++++++---------- kotlin-native/tools/llvm_builder/package.py | 10 ++--- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/kotlin-native/konan/konan.properties b/kotlin-native/konan/konan.properties index 6e2670dc129..662a5ca1ed2 100644 --- a/kotlin-native/konan/konan.properties +++ b/kotlin-native/konan/konan.properties @@ -36,10 +36,10 @@ homeDependencyCache = .konan/cache reducedLlvmAppendix = compact predefinedLlvmDistributions = \ - clang-llvm-8.0.0-linux-x86-64 \ - msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 \ - clang-llvm-apple-8.0.0-darwin-macos \ - clang-llvm-apple-8.0.0-darwin-macos-aarch64 + apple-llvm-20200714-macos-x64 \ + apple-llvm-20200714-macos-aarch64 \ + llvm-11.1.0-linux-x64-1 \ + llvm-11.1.0-windows-x64 predefinedLibffiVersions = \ libffi-3.2.1-3-darwin-macos \ @@ -47,17 +47,17 @@ predefinedLibffiVersions = \ libffi-3.2.1-2-linux-x86-64 \ libffi-3.2.1-mingw-w64-x86-64 -llvm.linux_x64.dev = clang-llvm-8.0.0-linux-x86-64 -llvm.linux_x64.user = clang-llvm-8.0.0-linux-x86-64 +llvm.linux_x64.dev = llvm-11.1.0-linux-x64-1 +llvm.linux_x64.user = llvm-11.1.0-linux-x64-1 -llvm.mingw_x64.dev = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 -llvm.mingw_x64.user = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 +llvm.mingw_x64.dev = llvm-11.1.0-windows-x64 +llvm.mingw_x64.user = llvm-11.1.0-windows-x64 -llvm.macos_x64.dev = clang-llvm-apple-8.0.0-darwin-macos -llvm.macos_x64.user = clang-llvm-apple-8.0.0-darwin-macos +llvm.macos_x64.dev = apple-llvm-20200714-macos-x64 +llvm.macos_x64.user = apple-llvm-20200714-macos-x64 -llvm.macos_arm64.dev = clang-llvm-apple-8.0.0-darwin-macos-aarch64 -llvm.macos_arm64.user = clang-llvm-apple-8.0.0-darwin-macos-aarch64 +llvm.macos_arm64.dev = apple-llvm-20200714-macos-aarch64 +llvm.macos_arm64.user = apple-llvm-20200714-macos-aarch64 # By default LLVM uses 250 for -03 builds. # We use a smaller value since default value leads to @@ -69,10 +69,10 @@ clangDebugFlags = -O0 linkerGccFlags = -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed -llvmVersion.linux_x64 = 8.0.0 -llvmVersion.mingw_x64 = 8.0.1 -llvmVersion.macos_x64 = 8.0.0 -llvmVersion.macos_arm64 = 8.0.0 +llvmVersion.linux_x64 = 11.1.0 +llvmVersion.mingw_x64 = 11.1.0 +llvmVersion.macos_x64 = 11.1.0 +llvmVersion.macos_arm64 = 11.1.0 cacheableTargets.macos_x64 = \ macos_x64 \ @@ -504,7 +504,7 @@ dependencies.linux_x64 = \ x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2 \ lldb-3-linux -targetToolchain.mingw_x64-linux_x64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 +targetToolchain.mingw_x64-linux_x64 = $llvmHome.mingw_x64 dependencies.mingw_x64-linux_x64 = \ x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2 @@ -555,7 +555,7 @@ runtimeDefinitions.linux_x64 = USE_GCC_UNWIND=1 KONAN_LINUX=1 KONAN_X64=1 \ gccToolchain.linux_arm32_hfp = arm-unknown-linux-gnueabihf-gcc-8.3.0-glibc-2.19-kernel-4.9-2 targetToolchain.linux_x64-linux_arm32_hfp = $gccToolchain.linux_arm32_hfp/arm-unknown-linux-gnueabihf -targetToolchain.mingw_x64-linux_arm32_hfp = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 +targetToolchain.mingw_x64-linux_arm32_hfp = $llvmHome.mingw_x64 targetToolchain.macos_x64-linux_arm32_hfp = $llvmHome.macos_x64 targetToolchain.macos_arm64-linux_arm32_hfp = $llvmHome.macos_arm64 @@ -611,7 +611,7 @@ runtimeDefinitions.linux_arm32_hfp = USE_GCC_UNWIND=1 KONAN_LINUX=1 \ gccToolchain.linux_arm64 = aarch64-unknown-linux-gnu-gcc-8.3.0-glibc-2.25-kernel-4.9-2 targetToolchain.linux_x64-linux_arm64 = $gccToolchain.linux_arm64/aarch64-unknown-linux-gnu -targetToolchain.mingw_x64-linux_arm64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 +targetToolchain.mingw_x64-linux_arm64 = $llvmHome.mingw_x64 targetToolchain.macos_x64-linux_arm64 = $llvmHome.macos_x64 targetToolchain.macos_arm64-linux_arm64 = $llvmHome.macos_arm64 @@ -872,7 +872,8 @@ targetToolchain.macos_x64-mingw_x64 = msys2-mingw-w64-x86_64-clang-llvm-lld-comp # for Windows we are currently using LLDB 9 dependencies.mingw_x64 = \ lldb-2-windows \ - lld-11.1.0-windows-x64 + lld-11.1.0-windows-x64 \ + msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 targetTriple.mingw_x64 = x86_64-pc-windows-gnu targetSysRoot.mingw_x64 = msys2-mingw-w64-x86_64-clang-llvm-lld-compiler_rt-8.0.1 diff --git a/kotlin-native/tools/llvm_builder/package.py b/kotlin-native/tools/llvm_builder/package.py index fa235d8bff3..17368d07780 100644 --- a/kotlin-native/tools/llvm_builder/package.py +++ b/kotlin-native/tools/llvm_builder/package.py @@ -234,7 +234,7 @@ def clone_llvm_repository(repo, branch, llvm_repo_destination): Downloads a single commit from the given repository. """ if host_is_darwin(): - default_repo, default_branch = "https://github.com/apple/llvm-project", "apple/stable/20200108" + default_repo, default_branch = "https://github.com/apple/llvm-project", "apple/stable/20200714" else: default_repo, default_branch = "https://github.com/llvm/llvm-project", "release/11.x" repo = default_repo if repo is None else repo @@ -245,12 +245,8 @@ def clone_llvm_repository(repo, branch, llvm_repo_destination): def default_num_stages(): - if host_is_darwin(): - # Bootstrap build is not working for https://github.com/apple/llvm-project + apple/stable/20200108. - # So use single phase for now. - return 1 - else: - return 2 + # Perform bootstrap build + return 2 def build_parser() -> argparse.ArgumentParser: