| 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/sanitizers/sanitizers.gni") | 11 import("//build/config/sanitizers/sanitizers.gni") |
| 11 import("//build/toolchain/toolchain.gni") | 12 import("//build/toolchain/toolchain.gni") |
| 12 | 13 |
| 13 declare_args() { | 14 declare_args() { |
| 14 # 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 |
| 15 # 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. |
| 16 # 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 |
| 17 # 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. |
| 18 concurrent_links = -1 | 19 concurrent_links = -1 |
| 19 } | 20 } |
| 20 | 21 |
| 21 if (concurrent_links == -1) { | 22 if (concurrent_links == -1) { |
| 22 if (allow_posix_link_time_opt || is_cfi) { | 23 if (allow_posix_link_time_opt || is_cfi) { |
| 23 _args = [ | 24 _args = [ |
| 24 "--mem_per_link_gb=24", | 25 "--mem_per_link_gb=24", |
| 25 "--reserve_mem_gb=10", | 26 "--reserve_mem_gb=10", |
| 26 ] | 27 ] |
| 27 } else if (is_win) { | 28 } else if (is_win) { |
| 28 _args = [ "--mem_per_link_gb=5" ] | 29 _args = [ "--mem_per_link_gb=5" ] |
| 29 } else if (is_mac) { | 30 } else if (is_mac) { |
| 30 _args = [ "--mem_per_link_gb=4" ] | 31 _args = [ "--mem_per_link_gb=4" ] |
| 32 } else if (is_android && !is_component_build && symbol_level == 2) { |
| 33 _args = [ "--mem_per_link_gb=25" ] |
| 31 } else { | 34 } else { |
| 32 _args = [] | 35 _args = [] |
| 33 } | 36 } |
| 34 | 37 |
| 35 # TODO(crbug.com/617429) Pass more build configuration info to the script | 38 # TODO(crbug.com/617429) Pass more build configuration info to the script |
| 36 # so that we can compute better values. | 39 # so that we can compute better values. |
| 37 concurrent_links = exec_script("get_concurrent_links.py", _args, "value") | 40 concurrent_links = exec_script("get_concurrent_links.py", _args, "value") |
| 38 } | 41 } |
| OLD | NEW |