Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3127)

Unified Diff: build/toolchain/toolchain.gni

Issue 2031233002: Rework how MB and GN handle concurrent links. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/toolchain/toolchain.gni
diff --git a/build/toolchain/toolchain.gni b/build/toolchain/toolchain.gni
index 9f564794816655edd06d110aeb2ce14390f037bb..0b7aacb7e383ebb63a420b234c0ed9f6df9693cb 100644
--- a/build/toolchain/toolchain.gni
+++ b/build/toolchain/toolchain.gni
@@ -6,8 +6,18 @@
# toolchain() rules themselves.
import("//build/config/chrome_build.gni")
+import("//build/config/sanitizers/sanitizers.gni")
declare_args() {
+ # Limit the number of concurrent links; we often want to run fewer
+ # links at once than we do compiles, because linking is memory-intensive.
+ # 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.
+ # we may be running *a lot* of compiles in parallel but can't do that
+ # many links in parallel. The default to use varies by platform and
+ # by the amount of memory available, so we call out to a script to
+ # get the right value.
+ concurrent_links = -1
+
# Enable Link Time Optimization in optimized builds (output programs run
# faster, but linking is up to 5-20x slower).
# Note: use target_os == "linux" rather than is_linux so that it does not
@@ -28,6 +38,15 @@ declare_args() {
}
}
+if (concurrent_links == -1) {
+ 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.
+ args = [ "--lto" ]
+ } else {
+ args = []
+ }
+ 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.
+}
+
# Subdirectory within root_out_dir for shared library files.
# TODO(agrieve): GYP sets this to "lib" for Linux & Android, but this won't work
# in GN until support for loadable_module() is added.

Powered by Google App Engine
This is Rietveld 408576698