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 Reland of http://crrev.com/1896163003 with fix. Review URL: https://codereview.chromium.org/1909163002 Cr-Original-Commit-Position: refs/heads/master@{#388971} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 920a09e4e58f92bf1ece1fcf1f31ec44185a4959
This commit is contained in:
Родитель
46630c2866
Коммит
89ef3456cd
|
@ -162,6 +162,11 @@ config("compiler") {
|
|||
configs += [ "//build/config/mac:compiler" ]
|
||||
}
|
||||
|
||||
# Applies to all Posix systems.
|
||||
if (is_posix) {
|
||||
configs += [ "//build/config/posix:compiler" ]
|
||||
}
|
||||
|
||||
# See the definitions below.
|
||||
configs += [
|
||||
":compiler_cpu_abi",
|
||||
|
|
|
@ -2,10 +2,26 @@
|
|||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/sanitizers/sanitizers.gni")
|
||||
import("//build/config/sysroot.gni")
|
||||
import("//build/toolchain/toolchain.gni")
|
||||
|
||||
assert(is_posix)
|
||||
|
||||
# This is included by reference in the //build/config/compiler config that
|
||||
# is applied to all Posix targets. It is here to separate out the logic that is
|
||||
# Posix-only. Note that this is in addition to an OS-specific variant of this
|
||||
# config.
|
||||
config("compiler") {
|
||||
if ((allow_posix_link_time_opt || is_cfi) && !is_nacl) {
|
||||
arflags = [
|
||||
"--plugin",
|
||||
rebase_path("//third_party/llvm-build/Release+Asserts/lib/LLVMgold.so",
|
||||
root_build_dir),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# This is included by reference in the //build/config/compiler:runtime_library
|
||||
# config that is applied to all targets. It is here to separate out the logic
|
||||
# that is Posix-only. Please see that target for advice on what should go in
|
||||
|
|
|
@ -103,6 +103,18 @@ config("compiler") {
|
|||
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") {
|
||||
|
|
|
@ -8,14 +8,6 @@ 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.
|
||||
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 @@ 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 = [
|
||||
|
|
|
@ -111,7 +111,7 @@ template("mac_toolchain") {
|
|||
}
|
||||
|
||||
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}}",
|
||||
|
|
|
@ -145,7 +145,7 @@ template("msvc_toolchain") {
|
|||
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче