Implement arflags in the GN build.

This flag was recently added in GN. This patch hooks it up to the toolchains
and moves some flags to use it that previously had to be hardcoded on the
tool command itself.

Remove concurrent_links variable from gcc_toolchain which was unused.

BUG=598599

Review URL: https://codereview.chromium.org/1896163003

Cr-Commit-Position: refs/heads/master@{#388554}
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 07408d6..23ad66c0 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -431,6 +431,12 @@
       ldflags += [ "-Wl,-plugin-opt,-function-sections" ]
     }
 
+    arflags = [
+      "--plugin",
+      rebase_path("//third_party/llvm-build/Release+Asserts/lib/LLVMgold.so",
+                  root_build_dir),
+    ]
+
     # TODO(pcc): Make these flags work correctly with CFI.
     if (!is_cfi) {
       cflags += [
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index bfa69be..7442ade5 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -103,6 +103,18 @@
     assert(!is_win_fastlink, "/PROFILE and /DEBUG:FASTLINK are incompatible")
     ldflags = [ "/PROFILE" ]
   }
+
+  # arflags apply only to static_libraries. The normal linker configs are only
+  # set for executable and shared library targets so arflags must be set
+  # elsewhere. Since this is relatively contained, we just apply them in this
+  # more general config and they will only have an effect on static libraries.
+  arflags = [
+    # "No public symbols found; archive member will be inaccessible." This
+    # means that one or more object files in the library can never be
+    # pulled in to targets that link to this library. It's just a warning that
+    # the source file is a no-op.
+    "/ignore:4221",
+  ]
 }
 
 config("vs_code_analysis") {
diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni
index 6ff2b586..56ae88c 100644
--- a/build/toolchain/gcc_toolchain.gni
+++ b/build/toolchain/gcc_toolchain.gni
@@ -8,14 +8,6 @@
 import("//build/toolchain/goma.gni")
 import("//build/toolchain/toolchain.gni")
 
-# This value will be inherited in the toolchain below.
-if (allow_posix_link_time_opt || is_cfi) {
-  concurrent_links =
-      exec_script("get_concurrent_links.py", [ "--lto" ], "value")
-} else {
-  concurrent_links = exec_script("get_concurrent_links.py", [], "value")
-}
-
 # This template defines a toolchain for something that works like gcc
 # (including clang).
 #
@@ -216,21 +208,13 @@
 
     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 = [
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn
index eb83248..2985987d 100644
--- a/build/toolchain/mac/BUILD.gn
+++ b/build/toolchain/mac/BUILD.gn
@@ -111,7 +111,7 @@
     }
 
     tool("alink") {
-      command = "rm -f {{output}} && ./gyp-mac-tool filter-libtool libtool -static -o {{output}} {{inputs}}"
+      command = "rm -f {{output}} && ./gyp-mac-tool filter-libtool libtool -static {{arflags}} -o {{output}} {{inputs}}"
       description = "LIBTOOL-STATIC {{output}}"
       outputs = [
         "{{output_dir}}/{{target_output_name}}{{output_extension}}",
diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn
index e2458e2..8e786187 100644
--- a/build/toolchain/win/BUILD.gn
+++ b/build/toolchain/win/BUILD.gn
@@ -145,7 +145,7 @@
 
     tool("alink") {
       rspfile = "{{output}}.rsp"
-      command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
+      command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo {{arflags}} /OUT:{{output}} @$rspfile"
       description = "LIB {{output}}"
       outputs = [
         # Ignore {{output_extension}} and always use .lib, there's no reason to