| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 # This file should only be imported from files that define toolchains. | 5 # This file should only be imported from files that define toolchains. |
| 6 # There's no way to enforce this exactly, but all toolchains are processed | 6 # There's no way to enforce this exactly, but all toolchains are processed |
| 7 # in the context of the default_toolchain, so we can at least check for that. | 7 # in the context of the default_toolchain, so we can at least check for that. |
| 8 assert(current_toolchain == default_toolchain) | 8 assert(current_toolchain == default_toolchain) |
| 9 | 9 |
| 10 import("//build/config/compiler/compiler.gni") | 10 import("//build/config/compiler/compiler.gni") |
| 11 import("//build/config/sanitizers/sanitizers.gni") | 11 import("//build/config/sanitizers/sanitizers.gni") |
| 12 import("//build/toolchain/toolchain.gni") | 12 import("//build/toolchain/toolchain.gni") |
| 13 | 13 |
| 14 declare_args() { | 14 declare_args() { |
| 15 # Limit the number of concurrent links; we often want to run fewer | 15 # Limit the number of concurrent links; we often want to run fewer |
| 16 # links at once than we do compiles, because linking is memory-intensive. | 16 # links at once than we do compiles, because linking is memory-intensive. |
| 17 # The default to use varies by platform and by the amount of memory | 17 # The default to use varies by platform and by the amount of memory |
| 18 # available, so we call out to a script to get the right value. | 18 # available, so we call out to a script to get the right value. |
| 19 concurrent_links = -1 | 19 concurrent_links = -1 |
| 20 } | 20 } |
| 21 | 21 |
| 22 if (concurrent_links == -1) { | 22 if (concurrent_links == -1) { |
| 23 if (allow_posix_link_time_opt || is_cfi) { | 23 if (allow_posix_link_time_opt || is_cfi) { |
| 24 _args = [ | 24 if (use_thin_lto) { |
| 25 "--mem_per_link_gb=26", | 25 _args = [ |
| 26 "--reserve_mem_gb=20", | 26 "--mem_per_link_gb=10", |
| 27 ] | 27 "--reserve_mem_gb=10", |
| 28 ] |
| 29 } else { |
| 30 # Full LTO, needs lots of RAM |
| 31 _args = [ |
| 32 "--mem_per_link_gb=26", |
| 33 "--reserve_mem_gb=20", |
| 34 ] |
| 35 } |
| 28 } else if (is_win) { | 36 } else if (is_win) { |
| 29 _args = [ "--mem_per_link_gb=5" ] | 37 _args = [ "--mem_per_link_gb=5" ] |
| 30 } else if (is_mac) { | 38 } else if (is_mac) { |
| 31 _args = [ "--mem_per_link_gb=4" ] | 39 _args = [ "--mem_per_link_gb=4" ] |
| 32 } else if (is_android && !is_component_build && symbol_level == 2) { | 40 } else if (is_android && !is_component_build && symbol_level == 2) { |
| 33 _args = [ "--mem_per_link_gb=25" ] | 41 _args = [ "--mem_per_link_gb=25" ] |
| 34 } else { | 42 } else { |
| 35 _args = [] | 43 _args = [] |
| 36 } | 44 } |
| 37 | 45 |
| 38 # TODO(crbug.com/617429) Pass more build configuration info to the script | 46 # TODO(crbug.com/617429) Pass more build configuration info to the script |
| 39 # so that we can compute better values. | 47 # so that we can compute better values. |
| 40 concurrent_links = exec_script("get_concurrent_links.py", _args, "value") | 48 concurrent_links = exec_script("get_concurrent_links.py", _args, "value") |
| 41 } | 49 } |
| OLD | NEW |