summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-09-14 14:40:01 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-14 21:41:14 +0000
commit4cab0f1c83325704d637168c43fabc894f97939d (patch)
tree2923e14d7f77d7bc766867dffdda7a01640556f7
parent125cde33c45c37472639c94e4af73760042bdcb0 (diff)
downloadchromium_src-4cab0f1c83325704d637168c43fabc894f97939d.zip
chromium_src-4cab0f1c83325704d637168c43fabc894f97939d.tar.gz
chromium_src-4cab0f1c83325704d637168c43fabc894f97939d.tar.bz2
Move sanitizer and symbol flags out of BUILDCONFIG
TBR=mmoss@chromium.org (chrome/installer/linux) CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1324623005 Cr-Commit-Position: refs/heads/master@{#348727}
-rw-r--r--base/BUILD.gn9
-rw-r--r--base/allocator/BUILD.gn4
-rw-r--r--base/third_party/dynamic_annotations/BUILD.gn2
-rw-r--r--breakpad/BUILD.gn2
-rw-r--r--build/config/BUILDCONFIG.gn76
-rw-r--r--build/config/compiler/BUILD.gn230
-rw-r--r--build/config/compiler/compiler.gni30
-rw-r--r--build/config/sanitizers/sanitizers.gni18
-rw-r--r--build/config/win/BUILD.gn1
-rw-r--r--build/secondary/third_party/libjpeg_turbo/BUILD.gn1
-rw-r--r--cc/BUILD.gn2
-rw-r--r--cc/base/BUILD.gn2
-rw-r--r--cc/surfaces/BUILD.gn2
-rw-r--r--chrome/installer/linux/BUILD.gn1
-rw-r--r--chrome/test/BUILD.gn1
-rw-r--r--chrome/tools/build/win/syzygy/BUILD.gn1
-rw-r--r--content/shell/BUILD.gn1
-rw-r--r--gpu/command_buffer/service/BUILD.gn2
-rw-r--r--net/BUILD.gn1
-rw-r--r--skia/BUILD.gn4
-rw-r--r--third_party/boringssl/BUILD.gn2
-rw-r--r--third_party/brotli/BUILD.gn6
-rw-r--r--third_party/opus/BUILD.gn2
-rw-r--r--tools/gn/docs/cookbook.md12
-rw-r--r--ui/base/BUILD.gn2
-rw-r--r--ui/gfx/BUILD.gn2
-rw-r--r--ui/gfx/geometry/BUILD.gn2
27 files changed, 243 insertions, 175 deletions
diff --git a/base/BUILD.gn b/base/BUILD.gn
index 912512f..cf8700f 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/compiler/compiler.gni")
import("//build/config/ui.gni")
import("//testing/test.gni")
@@ -941,7 +942,7 @@ component("base") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]
if (!is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
@@ -960,7 +961,7 @@ source_set("base_static") {
]
if (!is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
@@ -1017,7 +1018,7 @@ component("i18n") {
]
if (!is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
@@ -1135,7 +1136,7 @@ component("prefs") {
]
if (!is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
diff --git a/base/allocator/BUILD.gn b/base/allocator/BUILD.gn
index c12431b..32e5e6c 100644
--- a/base/allocator/BUILD.gn
+++ b/base/allocator/BUILD.gn
@@ -287,7 +287,7 @@ if (use_allocator == "tcmalloc") {
# Make sure the allocation library is optimized as much as possible when
# we"re in release mode.
if (!is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
@@ -306,7 +306,7 @@ source_set("allocator_extension_thunks") {
"allocator_extension_thunks.h",
]
if (is_android && !is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
diff --git a/base/third_party/dynamic_annotations/BUILD.gn b/base/third_party/dynamic_annotations/BUILD.gn
index bc324ae..86f6558 100644
--- a/base/third_party/dynamic_annotations/BUILD.gn
+++ b/base/third_party/dynamic_annotations/BUILD.gn
@@ -19,7 +19,7 @@ if (is_nacl) {
"dynamic_annotations.h",
]
if (is_android && !is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
diff --git a/breakpad/BUILD.gn b/breakpad/BUILD.gn
index c075816..5a4914a 100644
--- a/breakpad/BUILD.gn
+++ b/breakpad/BUILD.gn
@@ -262,7 +262,7 @@ if (current_toolchain == host_toolchain && is_mac) {
# not crash at -Os. To play it safe, dump_syms is always built
# at -O0 until this can be sorted out.
# http://code.google.com/p/google-breakpad/issues/detail?id=329
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
cflags += [ "-O0" ]
}
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 4630b2f..71161b0 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -111,14 +111,6 @@ if (current_os == "") {
# even if the value is overridden, which is wasteful. See first bullet.
declare_args() {
- # How many symbols to include in the build. This affects the performance of
- # the build since the symbols are large and dealing with them is slow.
- # 2 means regular build with symbols.
- # 1 means minimal symbols, usually enough for backtraces only.
- # 0 means no symbols.
- # -1 means auto-set (off in release, regular in debug).
- symbol_level = -1
-
# Component build.
is_component_build = false
@@ -133,18 +125,6 @@ declare_args() {
is_clang = current_os == "mac" || current_os == "ios" ||
current_os == "linux" || current_os == "chromeos"
- # Compile for Address Sanitizer to find memory bugs.
- is_asan = false
-
- # Compile for Leak Sanitizer to find leaks.
- is_lsan = false
-
- # Compile for Memory Sanitizer to find uninitialized reads.
- is_msan = false
-
- # Compile for Thread Sanitizer to find threading bugs.
- is_tsan = false
-
if (current_os == "chromeos") {
# Allows the target toolchain to be injected as arguments. This is needed
# to support the CrOS build system which supports per-build-configuration
@@ -176,7 +156,15 @@ declare_args() {
# and there's only one config to remove that's the same in all cases for
# targets that want to override it. It also means that the associated flags can
# be non-global.
-using_new_global_compiler_configs = false
+using_new_global_compiler_configs = true
+
+# To assist in a multi-sided landing of updating the default optimization
+# config. When false, this file sets up the default optimization config to be
+# either "no_optimize" (debug) or "optimize" (release). When true it will
+# always set the config "default_optimization".
+#
+# TODO(brettw) remove this when all repos are updated.
+using_new_optimization_config = true
# To assist in a multi-sided landing of updating the default optimization
# config. When false, this file sets up the default optimization config to be
@@ -184,7 +172,7 @@ using_new_global_compiler_configs = false
# always set the config "default_optimization".
#
# TODO(brettw) remove this when all repos are updated.
-using_new_optimization_config = false
+using_new_optimization_config = true
# =============================================================================
# OS DEFINITIONS
@@ -387,16 +375,6 @@ if (!is_chromeos) {
set_sources_assignment_filter(sources_assignment_filter)
# =============================================================================
-# BUILD OPTIONS
-# =============================================================================
-
-# These Sanitizers all imply using the Clang compiler. On Windows they either
-# don't work or work differently.
-if (!is_clang && (is_asan || is_lsan || is_tsan || is_msan)) {
- is_clang = true
-}
-
-# =============================================================================
# TARGET DEFAULTS
# =============================================================================
#
@@ -413,6 +391,8 @@ _native_compiler_configs = [
"//build/config/compiler:compiler_arm_fpu",
"//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs",
+ "//build/config/compiler:default_optimization",
+ "//build/config/compiler:default_symbols",
"//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library",
]
@@ -441,7 +421,6 @@ if (is_linux) {
} else if (is_mac) {
_native_compiler_configs += [ "//build/config/mac:sdk" ]
} else if (is_ios) {
- _native_compiler_configs += [ "//build/config/ios:sdk" ]
} else if (is_android) {
_native_compiler_configs += [ "//build/config/android:sdk" ]
}
@@ -453,41 +432,12 @@ if (is_clang && !is_nacl) {
]
}
-# Optimizations and debug checking.
+# Debug/release-related defines.
if (is_debug) {
_native_compiler_configs += [ "//build/config:debug" ]
- _default_optimization_config = "//build/config/compiler:no_optimize"
} else {
_native_compiler_configs += [ "//build/config:release" ]
- _default_optimization_config = "//build/config/compiler:optimize"
-}
-_native_compiler_configs += [ _default_optimization_config ]
-
-# If it wasn't manually set, set to an appropriate default.
-if (symbol_level == -1) {
- # Linux is slowed by having symbols as part of the target binary, whereas
- # Mac and Windows have them separate, so in Release Linux, default them off.
- if (is_debug || !is_linux) {
- symbol_level = 2
- } else if (is_asan || is_lsan || is_tsan || is_msan) {
- # Sanitizers require symbols for filename suppressions to work.
- symbol_level = 1
- } else {
- symbol_level = 0
- }
-}
-
-# Symbol setup.
-if (symbol_level == 2) {
- _default_symbols_config = "//build/config/compiler:symbols"
-} else if (symbol_level == 1) {
- _default_symbols_config = "//build/config/compiler:minimal_symbols"
-} else if (symbol_level == 0) {
- _default_symbols_config = "//build/config/compiler:no_symbols"
-} else {
- assert(false, "Bad value for symbol_level.")
}
-_native_compiler_configs += [ _default_symbols_config ]
# Windows linker setup for EXEs and DLLs.
if (is_win) {
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index 3291731..637d055 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -4,6 +4,9 @@
import("//build/config/android/config.gni")
import("//build/config/chrome_build.gni")
+import("//build/config/compiler/compiler.gni")
+import("//build/toolchain/ccache.gni")
+
if (current_cpu == "arm") {
import("//build/config/arm.gni")
}
@@ -17,9 +20,6 @@ if (is_win) {
import("//build/config/win/visual_studio_version.gni")
}
-import("//build/toolchain/ccache.gni")
-import("//build/config/sanitizers/sanitizers.gni")
-
declare_args() {
# Normally, Android builds are lightly optimized, even for debug builds, to
# keep binary size down. Setting this flag to true disables such optimization
@@ -84,11 +84,6 @@ config("default_include_dirs") {
]
}
-# TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr
-if (!is_win) {
- using_sanitizer = is_asan || is_lsan || is_tsan || is_msan
-}
-
# compiler ---------------------------------------------------------------------
#
# Base compiler configuration.
@@ -1211,14 +1206,15 @@ config("no_incompatible_pointer_warnings") {
# Optimization -----------------------------------------------------------------
#
-# Note that BUILDCONFIG.gn sets up a variable "default_optimization_config"
-# which it will assign to the config it implicitly applies to every target. If
-# you want to override the optimization level for your target, remove this
-# config (which will expand differently for debug or release builds), and then
-# add back the one you want to override it with:
+# The BUILDCONFIG file sets the "default_optimization" config on targets by
+# default. It will be equivalent to either "optimize" (release) or
+# "no_optimize" (debug) optimization configs.
+#
+# You can override the optimization level on a per-target basis by removing the
+# default config and then adding the named one you want:
#
-# configs -= default_optimization_config
-# configs += [ "//build/config/compiler/optimize_max" ]
+# configs -= [ "//build/config/compiler:default_optimization" ]
+# configs += [ "//build/config/compiler:optimize_max" ]
# Shared settings for both "optimize" and "optimize_max" configs.
# IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags.
@@ -1301,43 +1297,57 @@ if (is_win) {
}
}
-# Default "optimization on" config. On Windows, this favors size over speed.
+# Default "optimization on" config. Set up variables so the
+# "default_optimization" config can re-use these settings.
+if (is_win) {
+ # Favor size over speed, /O1 must be before the common flags. The GYP
+ # build also specifies /Os and /GF but these are implied by /O1.
+ optimize_cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ]
+} else if (is_android || is_ios) {
+ # Favor size over speed.
+ optimize_cflags = [ "-Os" ] + common_optimize_on_cflags
+} else {
+ # Linux & Mac favor speed over size.
+ # TODO(brettw) it's weird that Mac and desktop Linux are different. We should
+ # explore favoring size over speed in this case as well.
+ optimize_cflags = [ "-O2" ] + common_optimize_on_cflags
+}
+optimize_ldflags = common_optimize_on_ldflags
+
config("optimize") {
- if (is_win) {
- # Favor size over speed, /O1 must be before the common flags. The GYP
- # build also specifies /Os and /GF but these are implied by /O1.
- cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ]
- } else if (is_android || is_ios) {
- cflags = [ "-Os" ] + common_optimize_on_cflags # Favor size over speed.
- } else {
- cflags = [ "-O2" ] + common_optimize_on_cflags
+ cflags = optimize_cflags
+ ldflags = optimize_ldflags
+}
+
+# Turn off optimizations. Set up variables so the
+# "default_optimization" config can re-use these settings.
+if (is_win) {
+ no_optimize_cflags = [
+ "/Od", # Disable optimization.
+ "/Ob0", # Disable all inlining (on by default).
+ "/RTC1", # Runtime checks for stack frame and uninitialized variables.
+ ]
+ no_optimize_ldflags = []
+} else if (is_android && !android_full_debug) {
+ # On Android we kind of optimize some things that don't affect debugging
+ # much even when optimization is disabled to get the binary size down.
+ no_optimize_cflags = [
+ "-Os",
+ "-fdata-sections",
+ "-ffunction-sections",
+ ]
+ if (!using_sanitizer) {
+ no_optimize_cflags += [ "-fomit-frame-pointer" ]
}
- ldflags = common_optimize_on_ldflags
+ no_optimize_ldflags = common_optimize_on_ldflags
+} else {
+ no_optimize_cflags = [ "-O0" ]
+ no_optimize_ldflags = []
}
-# Turn off optimizations.
config("no_optimize") {
- if (is_win) {
- cflags = [
- "/Od", # Disable optimization.
- "/Ob0", # Disable all inlining (on by default).
- "/RTC1", # Runtime checks for stack frame and uninitialized variables.
- ]
- } else if (is_android && !android_full_debug) {
- # On Android we kind of optimize some things that don't affect debugging
- # much even when optimization is disabled to get the binary size down.
- cflags = [
- "-Os",
- "-fdata-sections",
- "-ffunction-sections",
- ]
- if (!using_sanitizer) {
- cflags += [ "-fomit-frame-pointer" ]
- }
- ldflags = common_optimize_on_ldflags
- } else {
- cflags = [ "-O0" ]
- }
+ cflags = no_optimize_cflags
+ ldflags = no_optimize_ldflags
}
# Turns up the optimization level. On Windows, this implies whole program
@@ -1368,53 +1378,105 @@ config("optimize_max") {
}
}
+# The default optimization applied to all targets. This will be equivalent to
+# either "optimize" or "no_optimize", depending on the build flags.
+config("default_optimization") {
+ if (is_debug) {
+ cflags = no_optimize_cflags
+ ldflags = no_optimize_ldflags
+ } else {
+ cflags = optimize_cflags
+ ldflags = optimize_ldflags
+ }
+}
+
# Symbols ----------------------------------------------------------------------
-config("symbols") {
- if (is_win) {
- import("//build/toolchain/goma.gni")
- if (use_goma) {
- cflags = [ "/Z7" ] # No PDB file
- } else {
- cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
- }
- if (is_win_fastlink) {
- # Tell VS 2015+ to create a PDB that references debug
- # information in .obj and .lib files instead of copying
- # it all. This flag is incompatible with /PROFILE
- ldflags = [ "/DEBUG:FASTLINK" ]
- } else {
- ldflags = [ "/DEBUG" ]
- }
+# The BUILDCONFIG file sets the "default_symbols" config on targets by
+# default. It will be equivalent to one the three specific symbol levels.
+#
+# You can override the symbol level on a per-target basis by removing the
+# default config and then adding the named one you want:
+#
+# configs -= [ "//build/config/compiler:default_symbols" ]
+# configs += [ "//build/config/compiler:symbols" ]
+
+# Full symbols.
+if (is_win) {
+ import("//build/toolchain/goma.gni")
+ if (use_goma) {
+ symbols_cflags = [ "/Z7" ] # No PDB file
} else {
- cflags = [ "-g2" ]
- if (use_debug_fission) {
- cflags += [ "-gsplit-dwarf" ]
- }
+ symbols_cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
}
+ if (is_win_fastlink) {
+ # Tell VS 2015+ to create a PDB that references debug
+ # information in .obj and .lib files instead of copying
+ # it all. This flag is incompatible with /PROFILE
+ symbols_ldflags = [ "/DEBUG:FASTLINK" ]
+ } else {
+ symbols_ldflags = [ "/DEBUG" ]
+ }
+} else {
+ symbols_cflags = [ "-g2" ]
+ if (use_debug_fission) {
+ symbols_cflags += [ "-gsplit-dwarf" ]
+ }
+ symbols_ldflags = []
}
-config("minimal_symbols") {
- if (is_win) {
- # Linker symbols for backtraces only.
- if (is_win_fastlink) {
- # Tell VS 2015+ to create a PDB that references debug
- # information in .obj and .lib files instead of copying
- # it all. This flag is incompatible with /PROFILE
- ldflags = [ "/DEBUG:FASTLINK" ]
- } else {
- ldflags = [ "/DEBUG" ]
- }
+config("symbols") {
+ cflags = symbols_cflags
+ ldflags = symbols_ldflags
+}
+
+# Minimal symbols.
+if (is_win) {
+ # Linker symbols for backtraces only.
+ minimal_symbols_cflags = []
+ if (is_win_fastlink) {
+ # Tell VS 2015+ to create a PDB that references debug
+ # information in .obj and .lib files instead of copying
+ # it all. This flag is incompatible with /PROFILE
+ minimal_symbols_ldflags = [ "/DEBUG:FASTLINK" ]
} else {
- cflags = [ "-g1" ]
- if (use_debug_fission) {
- cflags += [ "-gsplit-dwarf" ]
- }
+ minimal_symbols_ldflags = [ "/DEBUG" ]
+ }
+} else {
+ minimal_symbols_cflags = [ "-g1" ]
+ if (use_debug_fission) {
+ minimal_symbols_cflags += [ "-gsplit-dwarf" ]
}
+ minimal_symbols_ldflags = []
+}
+
+config("minimal_symbols") {
+ cflags = minimal_symbols_cflags
+ ldflags = minimal_symbols_ldflags
+}
+
+# No symbols.
+if (is_win) {
+ no_symbols_cflags = []
+} else {
+ no_symbols_cflags = [ "-g0" ]
}
config("no_symbols") {
- if (!is_win) {
- cflags = [ "-g0" ]
+ cflags = no_symbols_cflags
+}
+
+# Default symbols.
+config("default_symbols") {
+ if (symbol_level == 0) {
+ cflags = no_symbols_cflags
+ } else if (symbol_level == 1) {
+ cflags = minimal_symbols_cflags
+ ldflags = minimal_symbols_ldflags
+ } else if (symbol_level == 2) {
+ cflags = symbols_cflags
+ ldflags = symbols_ldflags
+ } else {
+ assert(false)
}
}
diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni
new file mode 100644
index 0000000..d5db930
--- /dev/null
+++ b/build/config/compiler/compiler.gni
@@ -0,0 +1,30 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# 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")
+
+declare_args() {
+ # How many symbols to include in the build. This affects the performance of
+ # the build since the symbols are large and dealing with them is slow.
+ # 2 means regular build with symbols.
+ # 1 means minimal symbols, usually enough for backtraces only.
+ # 0 means no symbols.
+ # -1 means auto-set according to debug/release and platform.
+ symbol_level = -1
+}
+
+# If it wasn't manually set, set to an appropriate default.
+assert(symbol_level >= -1 && symbol_level <= 2, "Invalid symbol_level")
+if (symbol_level == -1) {
+ # Linux is slowed by having symbols as part of the target binary, whereas
+ # Mac and Windows have them separate, so in Release Linux, default them off.
+ if (is_debug || !is_linux) {
+ symbol_level = 2
+ } else if (is_asan || is_lsan || is_tsan || is_msan) {
+ # Sanitizers require symbols for filename suppressions to work.
+ symbol_level = 1
+ } else {
+ symbol_level = 0
+ }
+}
diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni
index c575eb1..1aa212d 100644
--- a/build/config/sanitizers/sanitizers.gni
+++ b/build/config/sanitizers/sanitizers.gni
@@ -3,6 +3,18 @@
# found in the LICENSE file.
declare_args() {
+ # Compile for Address Sanitizer to find memory bugs.
+ is_asan = false
+
+ # Compile for Leak Sanitizer to find leaks.
+ is_lsan = false
+
+ # Compile for Memory Sanitizer to find uninitialized reads.
+ is_msan = false
+
+ # Compile for Thread Sanitizer to find threading bugs.
+ is_tsan = false
+
# Use libc++ (buildtools/third_party/libc++ and
# buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
# This is intended to be used for instrumented builds.
@@ -32,6 +44,12 @@ declare_args() {
use_cfi_diag = false
}
+# TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr
+using_sanitizer = is_asan || is_lsan || is_tsan || is_msan
+
+assert(!using_sanitizer || is_clang,
+ "Sanitizers (is_*san) require setting is_clang = true in 'gn args'")
+
# MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The
# same is possibly true for the other non-ASan sanitizers. But regardless of
# whether it links, one would normally never run a sanitizer in debug mode.
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index ba28c5e..e00c6d8 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/compiler/compiler.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/visual_studio_version.gni")
diff --git a/build/secondary/third_party/libjpeg_turbo/BUILD.gn b/build/secondary/third_party/libjpeg_turbo/BUILD.gn
index 4da2b7c..6be39fe 100644
--- a/build/secondary/third_party/libjpeg_turbo/BUILD.gn
+++ b/build/secondary/third_party/libjpeg_turbo/BUILD.gn
@@ -5,6 +5,7 @@
# Do not use the targets in this file unless you need a certain libjpeg
# implementation. Use the meta target //third_party:jpeg instead.
+import("//build/config/sanitizers/sanitizers.gni")
if (current_cpu == "arm") {
import("//build/config/arm.gni")
}
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index 6eab5c8..910888b 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -532,7 +532,7 @@ component("cc") {
defines = [ "CC_IMPLEMENTATION=1" ]
if (!is_debug && (is_win || is_android)) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
diff --git a/cc/base/BUILD.gn b/cc/base/BUILD.gn
index d02b900..019017c 100644
--- a/cc/base/BUILD.gn
+++ b/cc/base/BUILD.gn
@@ -48,7 +48,7 @@ source_set("base") {
defines = [ "CC_IMPLEMENTATION=1" ]
if (!is_debug && (is_win || is_android)) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
diff --git a/cc/surfaces/BUILD.gn b/cc/surfaces/BUILD.gn
index 3345caa..6dd7240 100644
--- a/cc/surfaces/BUILD.gn
+++ b/cc/surfaces/BUILD.gn
@@ -57,7 +57,7 @@ component("surfaces") {
]
if (is_android && !is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
index 7520f209..ddd2321 100644
--- a/chrome/installer/linux/BUILD.gn
+++ b/chrome/installer/linux/BUILD.gn
@@ -4,6 +4,7 @@
import("//build/config/chrome_build.gni")
import("//build/config/features.gni")
+import("//build/config/sanitizers/sanitizers.gni")
import("//build/util/version.gni")
import("//chrome/version.gni")
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 86da6de..7ac21c4 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/chrome_build.gni")
+import("//build/config/compiler/compiler.gni")
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
diff --git a/chrome/tools/build/win/syzygy/BUILD.gn b/chrome/tools/build/win/syzygy/BUILD.gn
index 14aa6fc..116318b 100644
--- a/chrome/tools/build/win/syzygy/BUILD.gn
+++ b/chrome/tools/build/win/syzygy/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/chrome_build.gni")
+import("//build/config/compiler/compiler.gni")
import("//build/config/sanitizers/sanitizers.gni")
declare_args() {
diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn
index e90f281..0d68b4f 100644
--- a/content/shell/BUILD.gn
+++ b/content/shell/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/features.gni")
+import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/config/win/manifest.gni")
import("//tools/grit/repack.gni")
diff --git a/gpu/command_buffer/service/BUILD.gn b/gpu/command_buffer/service/BUILD.gn
index 825b856..ec6d209 100644
--- a/gpu/command_buffer/service/BUILD.gn
+++ b/gpu/command_buffer/service/BUILD.gn
@@ -161,7 +161,7 @@ source_set("service_sources") {
if (is_android && !is_debug) {
# On Android optimize more since this component can be a bottleneck.
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}
diff --git a/net/BUILD.gn b/net/BUILD.gn
index 7b68ade..b626e4a 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/compiler/compiler.gni")
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
diff --git a/skia/BUILD.gn b/skia/BUILD.gn
index a5a0e4a..6e00377 100644
--- a/skia/BUILD.gn
+++ b/skia/BUILD.gn
@@ -489,7 +489,7 @@ component("skia") {
}
if (is_android && !is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
@@ -590,7 +590,7 @@ source_set("skia_opts") {
}
if (is_android && !is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
diff --git a/third_party/boringssl/BUILD.gn b/third_party/boringssl/BUILD.gn
index dba6a11..efef0fd 100644
--- a/third_party/boringssl/BUILD.gn
+++ b/third_party/boringssl/BUILD.gn
@@ -2,6 +2,8 @@
# 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")
+
# Config for us and everybody else depending on BoringSSL.
config("openssl_config") {
include_dirs = []
diff --git a/third_party/brotli/BUILD.gn b/third_party/brotli/BUILD.gn
index d50c694..bbc6ca0 100644
--- a/third_party/brotli/BUILD.gn
+++ b/third_party/brotli/BUILD.gn
@@ -41,11 +41,7 @@ source_set("brotli") {
]
# Since we are never debug brotli, freeze the optimizations to -O2.
- if (is_debug) {
- configs -= [ "//build/config/compiler:no_optimize" ]
- } else {
- configs -= [ "//build/config/compiler:optimize" ]
- }
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
include_dirs = [ "dec" ]
diff --git a/third_party/opus/BUILD.gn b/third_party/opus/BUILD.gn
index dd74d25..cc3d3cd 100644
--- a/third_party/opus/BUILD.gn
+++ b/third_party/opus/BUILD.gn
@@ -99,7 +99,7 @@ source_set("opus") {
if (!is_debug && is_posix &&
(current_cpu == "arm" || current_cpu == "arm64")) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
diff --git a/tools/gn/docs/cookbook.md b/tools/gn/docs/cookbook.md
index 6351645..3f2233c 100644
--- a/tools/gn/docs/cookbook.md
+++ b/tools/gn/docs/cookbook.md
@@ -166,7 +166,7 @@ places are noted in the table below.
| `arm_neon` (0/1) | `arm_use_neon` (true/false) | `//build/config/arm.gni` |
| `arm_neon_optional` (0/1) | `arm_optionally_use_neon` (true/false) | `//build/config/arm.gni` |
| `arm_version` | `arm_version` | `//build/config/arm.gni` |
-| `asan` (0/1) | `is_asan` (true/false) | (global) |
+| `asan` (0/1) | `is_asan` (true/false) | `//build/config/sanitizers/sanitizers.gni` |
| `branding` ("Chromium"/"Chrome") | `is_chrome_branded` (true/false) | `//build/config/chrome_build.gni` |
| `build_for_tool=="drmemory"` | `enable_iterator_debugging=false` | (internal to `//build/config/BUILD.gn`) |
| `build_for_tool=="tsan"` | `enable_iterator_debugging=false` | (internal to `//build/config/BUILD.gn`) |
@@ -177,22 +177,22 @@ places are noted in the table below.
| `component` ("shared_library"/"static_library") | `is_component_build` (true/false) | (global) |
| `desktop_linux` (0/1) | `is_desktop_linux` (true/false) | (global) |
| `disable_glibcxx_debug` (0/1) | `enable_iterator_debugging` (true/false) | (internal to `//build/config/BUILD.gn`) |
-| `fastbuild` (0/1/2) | `symbol_level` (2/1/0 — values inverted) | (global) |
+| `fastbuild` (0/1/2) | `symbol_level` (2/1/0 — values inverted) | `//build/config/compiler/compiler.gni` |
| `gomadir` | `goma_dir` | `//build/toolchain/goma.gni` |
| `ios_deployment_target` (string) | `ios_deployment_target` | `//build/config/ios/ios_sdk.gni` |
| `GYP_MSVS_OVERRIDE_PATH` environment variable | `visual_studio_path` | `//build/config/win/visual_studio_version.gni` |
| `GYP_MSVS_VERSION` environment variable | (none) | |
| `ios_sdk_path` | `ios_sdk_path` and `use_ios_simulator` | `//build/config/ios/ios_sdk.gni` |
-| `lsan` (0/1) | `is_lsan` (true/false) | (global) |
+| `lsan` (0/1) | `is_lsan` (true/false) | `//build/config/sanitizers/sanitizers.gni` |
| `mac_sdk_min` | `mac_sdk_min` | `//build/config/mac/mac_sdk.gni` |
| `mac_sdk_path` | `mac_sdk_path` | `//build/config/mac/mac_sdk.gni` |
| `mac_sdk` | `mac_sdk_version` | `//build/config/mac/mac_sdk.gni` |
-| `msan` (0/1) | `is_msan` (true/false) | (global) |
+| `msan` (0/1) | `is_msan` (true/false) | `//build/config/sanitizers/sanitizers.gni` |
| `SDKROOT` (Mac) | `sysroot` | `//build/config/sysroot.gni` |
| `sysroot` | `sysroot` | `//build/config/sysroot.gni` |
| `target_arch` ("ia32"/"x64"/"arm"/"mipsel") | `target_arch` ("x86"/"x64"/"arm"/"mipsel") | (global) |
| `toolkit_views` (0/1) | `toolkit_views` | `//build/config/ui.gni` |
-| `tsan` (0/1) | `is_tsan` (true/false) | (global) |
+| `tsan` (0/1) | `is_tsan` (true/false) | `//build/config/sanitizers/sanitizers.gni` |
| `windows_sdk_path` | `windows_sdk_path` | (internal to `//build/config/win/BUILD.gn`) |
### Feature flags
@@ -572,7 +572,7 @@ get the same behavior in GN, do:
```
if (!is_debug && is_win) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
```
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn
index e5e8ac9..b6420c6 100644
--- a/ui/base/BUILD.gn
+++ b/ui/base/BUILD.gn
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import("//build/config/compiler/compiler.gni")
+import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//testing/test.gni")
diff --git a/ui/gfx/BUILD.gn b/ui/gfx/BUILD.gn
index eea8cb2..f17b3677 100644
--- a/ui/gfx/BUILD.gn
+++ b/ui/gfx/BUILD.gn
@@ -329,7 +329,7 @@ component("gfx") {
}
if (!is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
diff --git a/ui/gfx/geometry/BUILD.gn b/ui/gfx/geometry/BUILD.gn
index ba94d3d..05ea40e 100644
--- a/ui/gfx/geometry/BUILD.gn
+++ b/ui/gfx/geometry/BUILD.gn
@@ -61,7 +61,7 @@ component("geometry") {
]
if (is_android && !is_debug) {
- configs -= [ "//build/config/compiler:optimize" ]
+ configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ]
}
}