diff --git a/DEPS b/DEPS index 97c6783ff11..38556fb78cb 100644 --- a/DEPS +++ b/DEPS @@ -37,9 +37,11 @@ vars = { "co19_rev": "@dec2b67aaab3bb7339b9764049707e71e601da3d", - # Revisions of GN related dependencies. This should match the revision - # pulled by Flutter. - "buildtools_revision": "@057ef89874e3c622248cf99259434fdc683c4e30", + # As Flutter does, we pull buildtools, including the clang toolchain, from + # Fuchsia. This revision should be kept up to date with the revision pulled + # by the Flutter engine. If there are problems with the toolchain, contact + # fuchsia-toolchain@. + "buildtools_revision": "@de2d6da936fa0be8bcb0bacd096fe124efff2854", # Scripts that make 'git cl format' work. "clang_format_scripts_rev": "@c09c8deeac31f05bd801995c475e7c8070f9ecda", diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 12dca5d3940..0c8bbea7e5b 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -341,9 +341,9 @@ config("compiler") { # define into the compile line. if (is_clang && (is_linux || is_mac)) { if (is_linux) { - toolchain_stamp_file = "//buildtools/linux64/toolchain.stamp" + toolchain_stamp_file = "//buildtools/linux64/clang.stamp" } else { - toolchain_stamp_file = "//buildtools/mac/toolchain.stamp" + toolchain_stamp_file = "//buildtools/mac/clang.stamp" } toolchain_version = read_file(toolchain_stamp_file, "trim string") defines = [ "TOOLCHAIN_VERSION=$toolchain_version" ] @@ -503,6 +503,10 @@ if (is_win) { "-Wno-unused-parameter", # Unused function parameters. ] + if (is_clang) { + default_warning_flags += [ "-Wno-tautological-constant-compare" ] + } + if (is_mac) { # TODO(abarth): Re-enable once https://github.com/domokit/mojo/issues/728 # is fixed. diff --git a/build/toolchain/android/BUILD.gn b/build/toolchain/android/BUILD.gn index 38f95b92b4f..8568ef7a4da 100644 --- a/build/toolchain/android/BUILD.gn +++ b/build/toolchain/android/BUILD.gn @@ -46,17 +46,8 @@ template("android_gcc_toolchain") { is_clang = invoker.is_clang if (is_clang) { - host_suffix = "" - if (host_os == "linux") { - host_suffix = "x86_64-linux" - } else if (host_os == "mac") { - host_suffix = "x86_64-darwin" - } else { - assert(false, "Unknown host") - } - - prefix = rebase_path("//buildtools/toolchain/clang+llvm-$host_suffix/bin", - root_build_dir) + prefix = + rebase_path("//buildtools/${host_os}-x64/clang/bin", root_build_dir) cc = compiler_prefix + prefix + "/clang" cxx = compiler_prefix + prefix + "/clang++" diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 08dd4179a0a..b21a7d1b27c 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -40,6 +40,9 @@ concurrent_links = exec_script("get_concurrent_links.py", [], "value") # Location of the strip executable. When specified, strip will be run on # all executables as they are built. The stripped artifacts will be put in # exe.stripped/. +# - llvm_objcopy +# Location of the llvm-objcopy executable. Used as strip instead of strip +# when specified. template("gcc_toolchain") { toolchain(target_name) { assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") @@ -193,7 +196,7 @@ template("gcc_toolchain") { outfile = "{{root_out_dir}}/$exename" rspfile = "$outfile.rsp" - if (defined(invoker.strip)) { + if (defined(invoker.strip) || defined(invoker.llvm_objcopy)) { stripped_outfile = "{{root_out_dir}}/exe.stripped/$exename" } @@ -203,6 +206,11 @@ template("gcc_toolchain") { strip_command = "${strip} --strip-unneeded -o $stripped_outfile $outfile" command += " && " + strip_command + } else if (defined(invoker.llvm_objcopy)) { + strip = invoker.llvm_objcopy + strip_command = + "${strip} --strip-all $outfile $stripped_outfile" + command += " && " + strip_command } if (defined(invoker.postlink)) { command += " && " + invoker.postlink @@ -212,7 +220,7 @@ template("gcc_toolchain") { outputs = [ outfile, ] - if (defined(invoker.strip)) { + if (defined(invoker.strip) || defined(invoker.llvm_objcopy)) { outputs += [ stripped_outfile ] } if (defined(invoker.link_outputs)) { diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn index 7a3d2dfe0a4..313deba7522 100644 --- a/build/toolchain/linux/BUILD.gn +++ b/build/toolchain/linux/BUILD.gn @@ -46,11 +46,12 @@ gcc_toolchain("clang_arm") { root_build_dir) cc = "${compiler_prefix}${prefix}/clang" cxx = "${compiler_prefix}${prefix}/clang++" - readelf = "readelf" + + readelf = "${prefix}/llvm-readelf" nm = "${prefix}/llvm-nm" ar = "${prefix}/llvm-ar" ld = cxx - strip = "${prefix}/strip" + llvm_objcopy = "${prefix}/llvm-objcopy" toolchain_cpu = "arm" toolchain_os = "linux" @@ -78,8 +79,7 @@ gcc_toolchain("arm64") { } gcc_toolchain("clang_arm64") { - prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-linux/bin", - root_build_dir) + prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) cc = "${compiler_prefix}${prefix}/clang" cxx = "${compiler_prefix}${prefix}/clang++" @@ -87,7 +87,7 @@ gcc_toolchain("clang_arm64") { nm = "${prefix}/llvm-nm" ar = "${prefix}/llvm-ar" ld = cxx - strip = "${prefix}/strip" + llvm_objcopy = "${prefix}/llvm-objcopy" toolchain_cpu = "arm64" toolchain_os = "linux" @@ -95,15 +95,15 @@ gcc_toolchain("clang_arm64") { } gcc_toolchain("clang_x86") { - prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-linux/bin", - root_build_dir) + prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) cc = "${compiler_prefix}${prefix}/clang" cxx = "${compiler_prefix}${prefix}/clang++" - readelf = "readelf" + + readelf = "${prefix}/llvm-readelf" nm = "${prefix}/llvm-nm" ar = "${prefix}/llvm-ar" ld = cxx - strip = "${prefix}/strip" + llvm_objcopy = "${prefix}/llvm-objcopy" toolchain_cpu = "x86" toolchain_os = "linux" @@ -127,16 +127,15 @@ gcc_toolchain("x86") { } gcc_toolchain("clang_x64") { - prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-linux/bin", - root_build_dir) + prefix = rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir) cc = "${compiler_prefix}${prefix}/clang" cxx = "${compiler_prefix}${prefix}/clang++" - readelf = "readelf" + readelf = "${prefix}/llvm-readelf" nm = "${prefix}/llvm-nm" ar = "${prefix}/llvm-ar" ld = cxx - strip = "${prefix}/strip" + llvm_objcopy = "${prefix}/llvm-objcopy" toolchain_cpu = "x64" toolchain_os = "linux" diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn index 4ccc69b24c6..4ed409af76c 100644 --- a/build/toolchain/mac/BUILD.gn +++ b/build/toolchain/mac/BUILD.gn @@ -222,8 +222,7 @@ template("mac_toolchain") { mac_toolchain("clang_x64") { toolchain_cpu = "x64" toolchain_os = "mac" - prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-darwin/bin", - root_build_dir) + 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" @@ -237,8 +236,7 @@ mac_toolchain("clang_x64") { mac_toolchain("clang_x86") { toolchain_cpu = "i386" toolchain_os = "mac" - prefix = rebase_path("//buildtools/toolchain/clang+llvm-x86_64-darwin/bin", - root_build_dir) + 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" diff --git a/tools/buildtools/update.py b/tools/buildtools/update.py index 43560c0af13..8658059c130 100755 --- a/tools/buildtools/update.py +++ b/tools/buildtools/update.py @@ -14,7 +14,6 @@ THIS_DIR = os.path.abspath(os.path.dirname(__file__)) DART_ROOT = os.path.abspath(os.path.join(THIS_DIR, '..', '..')) BUILDTOOLS = os.path.join(DART_ROOT, 'buildtools') TOOLS_BUILDTOOLS = os.path.join(DART_ROOT, 'tools', 'buildtools') -TOOLCHAIN = os.path.join(BUILDTOOLS, 'toolchain') sys.path.insert(0, os.path.join(DART_ROOT, 'tools')) import find_depot_tools @@ -24,7 +23,7 @@ DEPOT_PATH = find_depot_tools.add_depot_tools_to_path() def Update(): path = os.path.join(BUILDTOOLS, 'update.sh') - command = ['/bin/bash', path, '--toolchain', '--gn'] + command = ['/bin/bash', path, '--clang', '--gn'] return subprocess.call(command, cwd=DART_ROOT) @@ -74,17 +73,19 @@ def UpdateClangFormatOnWindows(): def CopyClangFormat(): if sys.platform == 'darwin': platform = 'darwin' - subdir = 'mac' + tools = 'mac' + toolchain = 'mac-x64' elif sys.platform.startswith('linux'): platform = 'linux' - subdir = 'linux64' + tools = 'linux64' + toolchain = 'linux-x64' else: print 'Unknown platform: ' + sys.platform return 1 clang_format = os.path.join( - TOOLCHAIN, 'clang+llvm-x86_64-' + platform, 'bin', 'clang-format') - dest = os.path.join(BUILDTOOLS, subdir, 'clang-format') + BUILDTOOLS, toolchain, 'clang', 'bin', 'clang-format') + dest = os.path.join(BUILDTOOLS, tools, 'clang-format') shutil.copy2(clang_format, dest) return 0