Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # Toolchain-related configuration that may be needed outside the context of the | 5 # Toolchain-related configuration that may be needed outside the context of the |
| 6 # toolchain() rules themselves. | 6 # toolchain() rules themselves. |
| 7 | 7 |
| 8 import("//build/config/chrome_build.gni") | 8 import("//build/config/chrome_build.gni") |
| 9 import("//build/config/sanitizers/sanitizers.gni") | |
| 9 | 10 |
| 10 declare_args() { | 11 declare_args() { |
| 12 # Limit the number of concurrent links; we often want to run fewer | |
| 13 # links at once than we do compiles, because linking is memory-intensive. | |
| 14 # In particular, when using distributed compilation (like w/ goma), | |
|
brucedawson
2016/06/03 19:42:17
This is true even without goma. On a Z840 we defau
Dirk Pranke
2016/06/05 01:19:49
Acknowledged.
| |
| 15 # we may be running *a lot* of compiles in parallel but can't do that | |
| 16 # many links in parallel. The default to use varies by platform and | |
| 17 # by the amount of memory available, so we call out to a script to | |
| 18 # get the right value. | |
| 19 concurrent_links = -1 | |
| 20 | |
| 11 # Enable Link Time Optimization in optimized builds (output programs run | 21 # Enable Link Time Optimization in optimized builds (output programs run |
| 12 # faster, but linking is up to 5-20x slower). | 22 # faster, but linking is up to 5-20x slower). |
| 13 # Note: use target_os == "linux" rather than is_linux so that it does not | 23 # Note: use target_os == "linux" rather than is_linux so that it does not |
| 14 # apply to host_toolchain when target_os="android". | 24 # apply to host_toolchain when target_os="android". |
| 15 allow_posix_link_time_opt = | 25 allow_posix_link_time_opt = |
| 16 target_os == "linux" && !is_chromeos && target_cpu == "x64" && | 26 target_os == "linux" && !is_chromeos && target_cpu == "x64" && |
| 17 is_chrome_branded && is_official_build | 27 is_chrome_branded && is_official_build |
| 18 | 28 |
| 19 # Set to true to use lld, the LLVM linker. This flag may be used on Windows | 29 # Set to true to use lld, the LLVM linker. This flag may be used on Windows |
| 20 # with the shipped LLVM toolchain, or on Linux with a self-built top-of-tree | 30 # with the shipped LLVM toolchain, or on Linux with a self-built top-of-tree |
| 21 # LLVM toolchain (see llvm_force_head_revision in | 31 # LLVM toolchain (see llvm_force_head_revision in |
| 22 # build/config/compiler/BUILD.gn). | 32 # build/config/compiler/BUILD.gn). |
| 23 use_lld = false | 33 use_lld = false |
| 24 | 34 |
| 25 if (is_clang) { | 35 if (is_clang) { |
| 26 # Clang compiler version. Clang files are placed at version-dependent paths. | 36 # Clang compiler version. Clang files are placed at version-dependent paths. |
| 27 clang_version = "3.9.0" | 37 clang_version = "3.9.0" |
| 28 } | 38 } |
| 29 } | 39 } |
| 30 | 40 |
| 41 if (concurrent_links == -1) { | |
| 42 if (allow_posix_link_time_opt || is_cfi) { | |
|
brucedawson
2016/06/03 19:42:17
Should we pass along more arguments to control the
brettw
2016/06/03 21:31:29
I'm OK writing a TODO with the information you wro
brucedawson
2016/06/03 22:04:50
Sounds good.
Dirk Pranke
2016/06/05 01:19:49
Will add.
| |
| 43 args = [ "--lto" ] | |
| 44 } else { | |
| 45 args = [] | |
| 46 } | |
| 47 concurrent_links = exec_script("get_concurrent_links.py", args, "value") | |
|
Dirk Pranke
2016/06/03 05:44:43
@brettw - am I right in thinking/remembering that
brettw
2016/06/03 21:31:29
This will be executed once for each toolchain that
Dirk Pranke
2016/06/05 01:19:49
Acknowledged.
| |
| 48 } | |
| 49 | |
| 31 # Subdirectory within root_out_dir for shared library files. | 50 # Subdirectory within root_out_dir for shared library files. |
| 32 # TODO(agrieve): GYP sets this to "lib" for Linux & Android, but this won't work | 51 # TODO(agrieve): GYP sets this to "lib" for Linux & Android, but this won't work |
| 33 # in GN until support for loadable_module() is added. | 52 # in GN until support for loadable_module() is added. |
| 34 # See: https://codereview.chromium.org/1236503002/ | 53 # See: https://codereview.chromium.org/1236503002/ |
| 35 shlib_subdir = "." | 54 shlib_subdir = "." |
| 36 | 55 |
| 37 # Root out dir for shared library files. | 56 # Root out dir for shared library files. |
| 38 root_shlib_dir = root_out_dir | 57 root_shlib_dir = root_out_dir |
| 39 if (shlib_subdir != ".") { | 58 if (shlib_subdir != ".") { |
| 40 root_shlib_dir += "/$shlib_subdir" | 59 root_shlib_dir += "/$shlib_subdir" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 71 stamp_description = "STAMP {{output}}" | 90 stamp_description = "STAMP {{output}}" |
| 72 copy_description = "COPY {{source}} {{output}}" | 91 copy_description = "COPY {{source}} {{output}}" |
| 73 if (host_os == "win") { | 92 if (host_os == "win") { |
| 74 stamp_command = "$python_path gyp-win-tool stamp {{output}}" | 93 stamp_command = "$python_path gyp-win-tool stamp {{output}}" |
| 75 copy_command = | 94 copy_command = |
| 76 "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}" | 95 "$python_path gyp-win-tool recursive-mirror {{source}} {{output}}" |
| 77 } else { | 96 } else { |
| 78 stamp_command = "touch {{output}}" | 97 stamp_command = "touch {{output}}" |
| 79 copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" | 98 copy_command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} && cp -af {{source}} {{output}})" |
| 80 } | 99 } |
| OLD | NEW |