diff options
author | mcgrathr <mcgrathr@chromium.org> | 2016-01-29 16:12:02 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-30 00:13:28 +0000 |
commit | b69e64de8c10dee033d42e8cd92dcca6f2f81411 (patch) | |
tree | 8558c278254951336cc339b7ee52c31e5fc5fb40 | |
parent | c7be6ba23955a16781f6341fd175128c108ee35e (diff) | |
download | chromium_src-b69e64de8c10dee033d42e8cd92dcca6f2f81411.zip chromium_src-b69e64de8c10dee033d42e8cd92dcca6f2f81411.tar.gz chromium_src-b69e64de8c10dee033d42e8cd92dcca6f2f81411.tar.bz2 |
GN: Use special toolchain for nacl64.exe, force is_component_build off
The nacl64.exe build within the Windows 32-bit x86 Chrome build is not
compatible with component-style builds. Build nacl64.exe in a special
variant of the x64 toolchain, wherein is_component_build is always false.
BUG=512869
CQ_EXTRA_TRYBOTS=tryserver.chromium.win:win8_chromium_gn_dbg,win_chromium_gn_x64_rel,win_clang_dbg
Review URL: https://codereview.chromium.org/1650633003
Cr-Commit-Position: refs/heads/master@{#372485}
-rw-r--r-- | build/toolchain/win/BUILD.gn | 72 | ||||
-rw-r--r-- | components/nacl/broker/BUILD.gn | 13 |
2 files changed, 65 insertions, 20 deletions
diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn index 4fb7279..858e9b4 100644 --- a/build/toolchain/win/BUILD.gn +++ b/build/toolchain/win/BUILD.gn @@ -225,9 +225,12 @@ template("msvc_toolchain") { if (defined(invoker.toolchain_os)) { current_os = invoker.toolchain_os } - if (defined(invoker.is_clang)) { - is_clang = invoker.is_clang - } + + forward_variables_from(invoker, + [ + "is_clang", + "is_component_build", + ]) # This value needs to be passed through unchanged. host_toolchain = host_toolchain @@ -284,21 +287,58 @@ x64_toolchain_data = exec_script("setup_toolchain.py", ], "scope") -msvc_toolchain("x64") { - environment = "environment.x64" - toolchain_cpu = "x64" - cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" - is_clang = false +template("win_x64_toolchains") { + # TODO(mcgrathr): These assignments are only required because of + # crbug.com/395883. Drop them if that ever gets fixed in GN. + concurrent_links = invoker.concurrent_links + goma_prefix = invoker.goma_prefix + x64_toolchain_data = invoker.x64_toolchain_data + clang_cl = invoker.clang_cl + + msvc_toolchain(target_name) { + environment = "environment.x64" + toolchain_cpu = "x64" + cl = "${goma_prefix}\"${x64_toolchain_data.vc_bin_dir}/cl.exe\"" + is_clang = false + + forward_variables_from(invoker, [ "is_component_build" ]) + } + + msvc_toolchain("clang_" + target_name) { + environment = "environment.x64" + toolchain_cpu = "x64" + prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", + root_build_dir) + cl = "${goma_prefix}$prefix/${clang_cl}" + toolchain_os = "win" + is_clang = true + + forward_variables_from(invoker, [ "is_component_build" ]) + } +} + +win_x64_toolchains("x64") { + # TODO(mcgrathr): These assignments are only required because of + # crbug.com/395883. Drop them if that ever gets fixed in GN. + concurrent_links = concurrent_links + goma_prefix = goma_prefix + x64_toolchain_data = x64_toolchain_data } -msvc_toolchain("clang_x64") { - environment = "environment.x64" - toolchain_cpu = "x64" - prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", - root_build_dir) - cl = "${goma_prefix}$prefix/${clang_cl}" - toolchain_os = "win" - is_clang = true +# The nacl_win64 toolchain is nearly identical to the plain x64 toolchain. +# It's used solely for building nacl64.exe (//components/nacl/broker:nacl64). +# The only reason it's a separate toolchain is so that it can force +# is_component_build to false in the toolchain_args() block, because +# building nacl64.exe in component style does not work. +win_x64_toolchains("nacl_win64") { + is_component_build = false + + # TODO(mcgrathr): These assignments are only required because of + # crbug.com/395883. Drop them if that ever gets fixed in GN. + concurrent_links = concurrent_links + goma_prefix = goma_prefix + x64_toolchain_data = x64_toolchain_data + clang_cl = clang_cl } # WinRT toolchains. Only define these when targeting them. diff --git a/components/nacl/broker/BUILD.gn b/components/nacl/broker/BUILD.gn index 390f239..aa8e3cb 100644 --- a/components/nacl/broker/BUILD.gn +++ b/components/nacl/broker/BUILD.gn @@ -58,9 +58,9 @@ if (current_cpu == "x86") { # NOTE: This must match what //build/config/BUILDCONFIG.gn uses # as default toolchain for the corresponding x64 build. if (is_clang) { - x64_toolchain = "//build/toolchain/win:clang_x64" + x64_toolchain = "//build/toolchain/win:clang_nacl_win64" } else { - x64_toolchain = "//build/toolchain/win:x64" + x64_toolchain = "//build/toolchain/win:nacl_win64" } nacl64_label = ":nacl64($x64_toolchain)" nacl64_out_dir = get_label_info(nacl64_label, "root_out_dir") @@ -82,8 +82,13 @@ if (current_cpu == "x86") { # //build/config/compiler:optimize{,_max} adds this for official builds # only, as it only reduces binary size and is not necessary for # correctness. But for nacl64.exe, it makes more than a six-fold - # difference in the binary size, so always use it. - ldflags = [ "/OPT:REF" ] + # difference in the binary size, so always use it in release builds. + # Note that using this flag disables incremental linking. In debug + # builds, incremental rebuild time is usually of more concern than + # binary size, so incremental linking is preferable to size reduction. + if (!is_debug) { + ldflags = [ "/OPT:REF" ] + } sources = [ "//chrome/nacl/nacl_exe_win_64.cc", |