diff --git a/DEPS b/DEPS index 0503ab8ed0e..e0a9745fdf3 100644 --- a/DEPS +++ b/DEPS @@ -74,8 +74,8 @@ vars = { # 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": "c2592c374e469f343ecea82d6728609650924259", - "gn_revision": "d7c2209cebcfe37f46dba7be4e1a7000ffc342fb", + "clang_revision": "60d276923902051192eba692e5312e605c9d9f65", + "gn_revision": "0bcd37bd2b83f1a9ee17088037ebdfe6eab6d31a", # Ninja, runs the build based on files generated by GN. "ninja_tag": "version:2@1.11.1.chromium.4", @@ -474,8 +474,7 @@ deps = { "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": { @@ -498,6 +497,16 @@ deps = { "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 c2ba3f7ac31..49cc5097ac0 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 c2b1643d77d..4e2a79debf4 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -377,7 +377,10 @@ config("compiler") { } 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" } @@ -548,6 +551,7 @@ if (is_win) { "-Wno-microsoft-unqualified-friend", "-Wno-unknown-argument", # icu "-Wno-unused-value", # crashpad + "-Wno-deprecated-non-prototype", # zlib ] } else { default_warning_flags += [ @@ -579,6 +583,7 @@ if (is_win) { default_warning_flags += [ "-Wno-tautological-constant-compare", "-Wno-unused-but-set-variable", # icu + "-Wno-deprecated-non-prototype", # zlib ] } else { default_warning_flags += diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn index 2b9c42608fd..1dd0cdac08e 100644 --- a/build/toolchain/mac/BUILD.gn +++ b/build/toolchain/mac/BUILD.gn @@ -20,6 +20,15 @@ if (use_goma) { 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 @@ template("mac_toolchain") { } } -# 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_x86") { 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" diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index 3e6c317b746..c62a2b03cd6 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -61,6 +61,24 @@ config("dart_precompiled_runtime_config") { ] } +config("add_empty_macho_section_config") { + if (is_mac) { + # We create an empty __space_for_note section in a __CUSTOM segment to + # reserve the header space needed for inserting a snapshot into the + # executable when creating standalone executables. This segment and section + # is removed in standalone executables, replaced with a note that points to + # the snapshot in the file. + # + # (A segment load command with a single section is 132 bytes in 32-bit + # executables and 152 bytes in 64-bit ones, and a note load command is + # always 40 bytes.) + # + # Keep this in sync with the constants reservedSegmentName and + # reservedSectionName in pkg/dart2native/lib/macho_utils.dart. + ldflags = [ "-Wl,-add_empty_section,__CUSTOM,__space_for_note" ] + } +} + # Controls DART_PRECOMPILER #define. config("dart_precompiler_config") { defines = [] diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn index a22b8ef9f7c..4bd01e4ea5c 100644 --- a/runtime/bin/BUILD.gn +++ b/runtime/bin/BUILD.gn @@ -831,7 +831,10 @@ dart_executable("dart") { } dart_executable("dart_precompiled_runtime") { - extra_configs = [ "..:dart_precompiled_runtime_config" ] + extra_configs = [ + "..:dart_precompiled_runtime_config", + "..:add_empty_macho_section_config", + ] extra_deps = [ "..:libdart_precompiled_runtime", "../platform:libdart_platform_precompiled_runtime", @@ -862,7 +865,10 @@ dart_executable("dart_precompiled_runtime") { dart_executable("dart_precompiled_runtime_product") { use_product_mode = true - extra_configs = [ "..:dart_precompiled_runtime_config" ] + extra_configs = [ + "..:dart_precompiled_runtime_config", + "..:add_empty_macho_section_config", + ] extra_deps = [ "..:libdart_precompiled_runtime_product", "../platform:libdart_platform_precompiled_runtime_product", diff --git a/runtime/vm/malloc_hooks_ia32.cc b/runtime/vm/malloc_hooks_ia32.cc index 2b7a3710a79..0572ac03400 100644 --- a/runtime/vm/malloc_hooks_ia32.cc +++ b/runtime/vm/malloc_hooks_ia32.cc @@ -11,9 +11,9 @@ namespace dart { #if defined(DEBUG) -const intptr_t kSkipCount = 6; +const intptr_t kSkipCount = 7; #elif !(defined(PRODUCT) || defined(DEBUG)) -const intptr_t kSkipCount = 5; +const intptr_t kSkipCount = 6; #endif } // namespace dart