Update clang and gn to match Fuchsia. Begin using mac-arm64 toolchain instead of mac-x64 under Rosetta for non-Goma builds. Bug: https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=73385 Change-Id: I40f311dea1845b9abe11f28832582104cf43a4bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/252867 Reviewed-by: Alexander Thomas <athom@google.com> Auto-Submit: Ryan Macnak <rmacnak@google.com> Commit-Queue: Alexander Thomas <athom@google.com>
diff --git a/DEPS b/DEPS index 991d17b..c62c71f 100644 --- a/DEPS +++ b/DEPS
@@ -66,8 +66,8 @@ # The list of revisions for these tools comes from Fuchsia, here: # https://fuchsia.googlesource.com/integration/+/HEAD/toolchain # If there are problems with the toolchain, contact fuchsia-toolchain@. - "clang_revision": "aaaf8e4c409f080f35ea227b20dc6ac8a45c2fa4", - "gn_revision": "e62d4e1938a45babc9afb6db543f388cd1802a52", + "clang_revision": "60d276923902051192eba692e5312e605c9d9f65", + "gn_revision": "0bcd37bd2b83f1a9ee17088037ebdfe6eab6d31a", # Scripts that make 'git cl format' work. "clang_format_scripts_rev": "bb994c6f067340c1135eb43eed84f4b33cfa7397", @@ -454,8 +454,7 @@ "version": "git_revision:" + Var("clang_revision"), }, ], - # TODO(https://fxbug.dev/73385): Use arm64 toolchain on arm64 when it exists. - "condition": "host_cpu == x64 and host_os == mac or host_cpu == arm64 and host_os == mac", + "condition": "host_os == mac", # On ARM64 Macs too because Goma doesn't support the host-arm64 toolchain. "dep_type": "cipd", }, Var("dart_root") + "/buildtools/win-x64/clang": { @@ -478,6 +477,16 @@ "condition": "host_os == 'linux' and host_cpu == 'arm64'", "dep_type": "cipd", }, + Var("dart_root") + "/buildtools/mac-arm64/clang": { + "packages": [ + { + "package": "fuchsia/third_party/clang/mac-arm64", + "version": "git_revision:" + Var("clang_revision"), + }, + ], + "condition": "host_os == 'mac' and host_cpu == 'arm64'", + "dep_type": "cipd", + }, Var("dart_root") + "/third_party/webdriver/chrome": { "packages": [
diff --git a/build/config/clang/clang.gni b/build/config/clang/clang.gni index c2ba3f7..49cc509 100644 --- a/build/config/clang/clang.gni +++ b/build/config/clang/clang.gni
@@ -2,9 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("../../toolchain/goma.gni") + _toolchain_cpu = host_cpu -if (host_os == "mac") { - # TODO(https://fxbug.dev/73385): Use arm64 toolchain on arm64 when it exists. +if (host_os == "mac" && use_goma) { + # Goma does not support ARM64. _toolchain_cpu = "x64" }
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 1508689..4e2a79d 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn
@@ -377,7 +377,10 @@ } else if (is_linux) { toolchain_stamp_file = "//buildtools/linux-x64/clang/.versions/clang.cipd_version" - } else { + } else if (is_mac && host_cpu == "arm64") { + toolchain_stamp_file = + "//buildtools/mac-arm64/clang/.versions/clang.cipd_version" + } else if (is_mac) { toolchain_stamp_file = "//buildtools/mac-x64/clang/.versions/clang.cipd_version" }
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn index 2b9c426..1dd0cda 100644 --- a/build/toolchain/mac/BUILD.gn +++ b/build/toolchain/mac/BUILD.gn
@@ -20,6 +20,15 @@ goma_prefix = "" } +# Goma doesn't support the host-arm64 toolchain, so continue using Rosetta. +if (host_cpu == "arm64" && !use_goma) { + rebased_clang_dir = + rebase_path("//buildtools/mac-arm64/clang/bin", root_build_dir) +} else { + rebased_clang_dir = + rebase_path("//buildtools/mac-x64/clang/bin", root_build_dir) +} + # Shared toolchain definition. Invocations should set toolchain_os to set the # build args in this definition. template("mac_toolchain") { @@ -211,28 +220,10 @@ } } -# Toolchain used for Mac host targets. mac_toolchain("clang_x64") { toolchain_cpu = "x64" toolchain_os = "mac" - prefix = rebase_path("//buildtools/mac-x64/clang/bin", root_build_dir) - cc = "${goma_prefix}$prefix/clang" - cxx = "${goma_prefix}$prefix/clang++" - ar = "${prefix}/llvm-ar" - ld = cxx - strip = "strip" - is_clang = true - if (mac_enable_relative_sdk_path) { - mac_sdk_path = rebase_path(mac_sdk_path, root_build_dir) - } - sysroot_flags = "-isysroot $mac_sdk_path -mmacosx-version-min=$mac_sdk_min" -} - -# Toolchain used for Mac host (i386) targets. -mac_toolchain("clang_x86") { - toolchain_cpu = "i386" - toolchain_os = "mac" - prefix = rebase_path("//buildtools/mac-x64/clang/bin", root_build_dir) + prefix = rebased_clang_dir cc = "${goma_prefix}$prefix/clang" cxx = "${goma_prefix}$prefix/clang++" ar = "${prefix}/llvm-ar" @@ -248,7 +239,7 @@ mac_toolchain("clang_arm64") { toolchain_cpu = "arm64" toolchain_os = "mac" - prefix = rebase_path("//buildtools/mac-x64/clang/bin", root_build_dir) + prefix = rebased_clang_dir cc = "${goma_prefix}$prefix/clang" cxx = "${goma_prefix}$prefix/clang++" ar = "${prefix}/llvm-ar"