Update BUILD.gn
This commit is contained in:
parent
daa7d2ceef
commit
a7fc464fef
1 changed files with 53 additions and 11 deletions
|
@ -85,9 +85,6 @@ declare_args() {
|
|||
# the needed gcov profiling data.
|
||||
auto_profile_path = ""
|
||||
|
||||
# Allow projects that wish to stay on C++11 to override Chromium's default.
|
||||
use_cxx11 = false
|
||||
|
||||
# Path to an AFDO profile to use while building with clang, if any. Empty
|
||||
# implies none.
|
||||
clang_sample_profile_path = ""
|
||||
|
@ -593,6 +590,15 @@ config("compiler") {
|
|||
if (is_clang) {
|
||||
cflags_cc += [ "-fno-trigraphs" ]
|
||||
}
|
||||
} else if (is_linux) {
|
||||
# TODO(crbug.com/1284275): Switch to C++20 on all platforms.
|
||||
if (is_clang) {
|
||||
cflags_cc += [ "-std=${standard_prefix}++20" ]
|
||||
} else {
|
||||
# The gcc bots are currently using GCC 9, which is not new enough to
|
||||
# support "c++20"/"gnu++20".
|
||||
cflags_cc += [ "-std=${standard_prefix}++2a" ]
|
||||
}
|
||||
} else {
|
||||
cflags_cc += [ "-std=${standard_prefix}++17" ]
|
||||
}
|
||||
|
@ -606,8 +612,13 @@ config("compiler") {
|
|||
# turned off we need the !is_nacl clause and the (is_nacl && is_clang)
|
||||
# clause, above.
|
||||
cflags_c += [ "-std=c11" ]
|
||||
if (is_apple) {
|
||||
# TODO(crbug.com/1284275): Switch to C++20 on all platforms.
|
||||
cflags_cc += [ "-std=c++20" ]
|
||||
} else {
|
||||
cflags_cc += [ "-std=c++17" ]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_clang && current_os != "zos") {
|
||||
# C++17 removes trigraph support, but clang still warns that it ignores
|
||||
|
@ -729,6 +740,12 @@ config("compiler") {
|
|||
ldflags += [ "-Wl,--no-rosegment" ]
|
||||
}
|
||||
|
||||
# TODO(crbug.com/1374347): Cleanup undefined symbol errors caught by
|
||||
# --no-undefined-version.
|
||||
if (use_lld && !is_win && !is_mac && !is_ios) {
|
||||
ldflags += [ "-Wl,--undefined-version" ]
|
||||
}
|
||||
|
||||
# LLD does call-graph-sorted binary layout by default when profile data is
|
||||
# present. On Android this increases binary size due to more thinks for long
|
||||
# jumps. Turn it off by default and enable selectively for targets where it's
|
||||
|
@ -1191,6 +1208,15 @@ config("compiler_cpu_abi") {
|
|||
ldflags += [ "--target=riscv64-linux-gnu" ]
|
||||
}
|
||||
cflags += [ "-mabi=lp64d" ]
|
||||
} else if (current_cpu == "loong64") {
|
||||
if (is_clang) {
|
||||
cflags += [ "--target=loongarch64-linux-gnu" ]
|
||||
ldflags += [ "--target=loongarch64-linux-gnu" ]
|
||||
}
|
||||
cflags += [
|
||||
"-mabi=lp64d",
|
||||
"-mcmodel=medium",
|
||||
]
|
||||
} else if (current_cpu == "s390x") {
|
||||
cflags += [ "-m64" ]
|
||||
ldflags += [ "-m64" ]
|
||||
|
@ -1236,6 +1262,7 @@ config("compiler_codegen") {
|
|||
config("compiler_deterministic") {
|
||||
cflags = []
|
||||
ldflags = []
|
||||
swiftflags = []
|
||||
|
||||
# Eliminate build metadata (__DATE__, __TIME__ and __TIMESTAMP__) for
|
||||
# deterministic build. See https://crbug.com/314403
|
||||
|
@ -1276,6 +1303,7 @@ config("compiler_deterministic") {
|
|||
# -ffile-compilation-dir is an alias for both -fdebug-compilation-dir=
|
||||
# and -fcoverage-compilation-dir=.
|
||||
cflags += [ "-ffile-compilation-dir=." ]
|
||||
swiftflags += [ "-file-compilation-dir=." ]
|
||||
}
|
||||
if (!is_win) {
|
||||
# We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
|
||||
|
@ -1522,6 +1550,16 @@ config("default_warnings") {
|
|||
]
|
||||
}
|
||||
|
||||
if (!is_nacl || is_nacl_saigo) {
|
||||
cflags += [
|
||||
# An ABI compat warning we don't care about, https://crbug.com/1102157
|
||||
# TODO(thakis): Push this to the (few) targets that need it,
|
||||
# instead of having a global flag.
|
||||
"-Wno-psabi",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_clang) {
|
||||
cflags += [
|
||||
"-Wloop-analysis",
|
||||
|
@ -1542,11 +1580,6 @@ config("default_warnings") {
|
|||
cflags += [
|
||||
"-Wenum-compare-conditional",
|
||||
|
||||
# An ABI compat warning we don't care about, https://crbug.com/1102157
|
||||
# TODO(thakis): Push this to the (few) targets that need it,
|
||||
# instead of having a global flag.
|
||||
"-Wno-psabi",
|
||||
|
||||
# Ignore warnings about MSVC optimization pragmas.
|
||||
# TODO(thakis): Only for no_chromium_code? http://crbug.com/912662
|
||||
"-Wno-ignored-pragma-optimize",
|
||||
|
@ -1645,7 +1678,7 @@ config("chromium_code") {
|
|||
if (!is_debug && !using_sanitizer && current_cpu != "s390x" &&
|
||||
current_cpu != "s390" && current_cpu != "ppc64" &&
|
||||
current_cpu != "mips" && current_cpu != "mips64" &&
|
||||
current_cpu != "riscv64") {
|
||||
current_cpu != "riscv64" && current_cpu != "loong64") {
|
||||
# Non-chromium code is not guaranteed to compile cleanly with
|
||||
# _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
|
||||
# disabled, so only do that for Release build.
|
||||
|
@ -1955,6 +1988,9 @@ config("no_incompatible_pointer_warnings") {
|
|||
"-mllvm", "-unroll-runtime-multi-exit",
|
||||
"-mllvm", "-aggressive-ext-opt",
|
||||
"-mllvm", "-polly",
|
||||
"-mllvm", "-polly-detect-profitability-min-per-loop-insts=40",
|
||||
"-mllvm", "-polly-invariant-load-hoisting",
|
||||
"-mllvm", "-polly-vectorizer=stripmine",
|
||||
"/O3",
|
||||
"/clang:-O3",
|
||||
"/clang:-mavx",
|
||||
|
@ -2007,6 +2043,9 @@ if (is_win) {
|
|||
"-mllvm", "-unroll-runtime-multi-exit",
|
||||
"-mllvm", "-aggressive-ext-opt",
|
||||
"-mllvm", "-polly",
|
||||
"-mllvm", "-polly-detect-profitability-min-per-loop-insts=40",
|
||||
"-mllvm", "-polly-invariant-load-hoisting",
|
||||
"-mllvm", "-polly-vectorizer=stripmine",
|
||||
"/O3",
|
||||
"/clang:-O3",
|
||||
"/clang:-mavx",
|
||||
|
@ -2056,6 +2095,9 @@ if (is_win) {
|
|||
"-mllvm", "-unroll-runtime-multi-exit",
|
||||
"-mllvm", "-aggressive-ext-opt",
|
||||
"-mllvm", "-polly",
|
||||
"-mllvm", "-polly-detect-profitability-min-per-loop-insts=40",
|
||||
"-mllvm", "-polly-invariant-load-hoisting",
|
||||
"-mllvm", "-polly-vectorizer=stripmine",
|
||||
"-O3",
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in a new issue