Index: build/toolchain/gcc_toolchain.gni |
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni |
index 6ff2b586ada2d9effc814f3f9c93d3f4b0891cf5..2840ae0adf9f2d2298f43a6a26c9ee99d128f35d 100644 |
--- a/build/toolchain/gcc_toolchain.gni |
+++ b/build/toolchain/gcc_toolchain.gni |
@@ -8,12 +8,14 @@ import("//build/toolchain/cc_wrapper.gni") |
import("//build/toolchain/goma.gni") |
import("//build/toolchain/toolchain.gni") |
-# This value will be inherited in the toolchain below. |
+# "concurrent_links" is a toolchain variable. By computing it here rather than |
+# inside the toolchain, the exec_script will only get run once rather than |
+# each time the toolchain template is invoked. |
if (allow_posix_link_time_opt || is_cfi) { |
- concurrent_links = |
+ concurrent_links_ = |
exec_script("get_concurrent_links.py", [ "--lto" ], "value") |
} else { |
- concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
+ concurrent_links_ = exec_script("get_concurrent_links.py", [], "value") |
} |
# This template defines a toolchain for something that works like gcc |
@@ -101,6 +103,8 @@ template("gcc_toolchain") { |
assert(defined(invoker.toolchain_os), |
"gcc_toolchain() must specify a \"toolchain_os\"") |
+ concurrent_links = concurrent_links_ |
+ |
if (defined(invoker.cc_wrapper)) { |
cc_wrapper = invoker.cc_wrapper |
} |
@@ -216,21 +220,13 @@ template("gcc_toolchain") { |
tool("alink") { |
rspfile = "{{output}}.rsp" |
- arflags = "" |
- if ((allow_posix_link_time_opt || is_cfi) && |
- invoker.toolchain_os != "nacl") { |
- gold_plugin_path = rebase_path( |
- "//third_party/llvm-build/Release+Asserts/lib/LLVMgold.so", |
- root_build_dir) |
- arflags = "--plugin \"$gold_plugin_path\"" |
- } |
# This needs a Python script to avoid using simple sh features in this |
# command, in case the host does not use a POSIX shell (e.g. compiling |
# POSIX-like toolchains such as NaCl on Windows). |
ar_wrapper = |
rebase_path("//build/toolchain/gcc_ar_wrapper.py", root_build_dir) |
- command = "$python_path \"$ar_wrapper\" --output={{output}} --ar=\"$ar\" $arflags rcsD @\"$rspfile\"" |
+ command = "$python_path \"$ar_wrapper\" --output={{output}} --ar=\"$ar\" {{arflags}} rcsD @\"$rspfile\"" |
description = "AR {{output}}" |
rspfile_content = "{{inputs}}" |
outputs = [ |