Commit 4cab0f1c authored by brettw's avatar brettw Committed by Commit bot

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}
parent 125cde33
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/compiler/compiler.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//testing/test.gni") import("//testing/test.gni")
...@@ -941,7 +942,7 @@ component("base") { ...@@ -941,7 +942,7 @@ component("base") {
configs += [ "//build/config/compiler:wexit_time_destructors" ] configs += [ "//build/config/compiler:wexit_time_destructors" ]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
...@@ -960,7 +961,7 @@ source_set("base_static") { ...@@ -960,7 +961,7 @@ source_set("base_static") {
] ]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
...@@ -1017,7 +1018,7 @@ component("i18n") { ...@@ -1017,7 +1018,7 @@ component("i18n") {
] ]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
...@@ -1135,7 +1136,7 @@ component("prefs") { ...@@ -1135,7 +1136,7 @@ component("prefs") {
] ]
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
......
...@@ -287,7 +287,7 @@ if (use_allocator == "tcmalloc") { ...@@ -287,7 +287,7 @@ if (use_allocator == "tcmalloc") {
# Make sure the allocation library is optimized as much as possible when # Make sure the allocation library is optimized as much as possible when
# we"re in release mode. # we"re in release mode.
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
...@@ -306,7 +306,7 @@ source_set("allocator_extension_thunks") { ...@@ -306,7 +306,7 @@ source_set("allocator_extension_thunks") {
"allocator_extension_thunks.h", "allocator_extension_thunks.h",
] ]
if (is_android && !is_debug) { if (is_android && !is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
...@@ -19,7 +19,7 @@ if (is_nacl) { ...@@ -19,7 +19,7 @@ if (is_nacl) {
"dynamic_annotations.h", "dynamic_annotations.h",
] ]
if (is_android && !is_debug) { if (is_android && !is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
......
...@@ -262,7 +262,7 @@ if (current_toolchain == host_toolchain && is_mac) { ...@@ -262,7 +262,7 @@ if (current_toolchain == host_toolchain && is_mac) {
# not crash at -Os. To play it safe, dump_syms is always built # not crash at -Os. To play it safe, dump_syms is always built
# at -O0 until this can be sorted out. # at -O0 until this can be sorted out.
# http://code.google.com/p/google-breakpad/issues/detail?id=329 # http://code.google.com/p/google-breakpad/issues/detail?id=329
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
cflags += [ "-O0" ] cflags += [ "-O0" ]
} }
......
...@@ -111,14 +111,6 @@ if (current_os == "") { ...@@ -111,14 +111,6 @@ if (current_os == "") {
# even if the value is overridden, which is wasteful. See first bullet. # even if the value is overridden, which is wasteful. See first bullet.
declare_args() { 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. # Component build.
is_component_build = false is_component_build = false
...@@ -133,18 +125,6 @@ declare_args() { ...@@ -133,18 +125,6 @@ declare_args() {
is_clang = current_os == "mac" || current_os == "ios" || is_clang = current_os == "mac" || current_os == "ios" ||
current_os == "linux" || current_os == "chromeos" 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") { if (current_os == "chromeos") {
# Allows the target toolchain to be injected as arguments. This is needed # Allows the target toolchain to be injected as arguments. This is needed
# to support the CrOS build system which supports per-build-configuration # to support the CrOS build system which supports per-build-configuration
...@@ -176,7 +156,15 @@ declare_args() { ...@@ -176,7 +156,15 @@ declare_args() {
# and there's only one config to remove that's the same in all cases for # 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 # targets that want to override it. It also means that the associated flags can
# be non-global. # 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 # 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 # config. When false, this file sets up the default optimization config to be
...@@ -184,7 +172,7 @@ using_new_global_compiler_configs = false ...@@ -184,7 +172,7 @@ using_new_global_compiler_configs = false
# always set the config "default_optimization". # always set the config "default_optimization".
# #
# TODO(brettw) remove this when all repos are updated. # TODO(brettw) remove this when all repos are updated.
using_new_optimization_config = false using_new_optimization_config = true
# ============================================================================= # =============================================================================
# OS DEFINITIONS # OS DEFINITIONS
...@@ -386,16 +374,6 @@ if (!is_chromeos) { ...@@ -386,16 +374,6 @@ if (!is_chromeos) {
# your platform/toolkit/feature doesn't apply. # your platform/toolkit/feature doesn't apply.
set_sources_assignment_filter(sources_assignment_filter) 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 # TARGET DEFAULTS
# ============================================================================= # =============================================================================
...@@ -413,6 +391,8 @@ _native_compiler_configs = [ ...@@ -413,6 +391,8 @@ _native_compiler_configs = [
"//build/config/compiler:compiler_arm_fpu", "//build/config/compiler:compiler_arm_fpu",
"//build/config/compiler:chromium_code", "//build/config/compiler:chromium_code",
"//build/config/compiler:default_include_dirs", "//build/config/compiler:default_include_dirs",
"//build/config/compiler:default_optimization",
"//build/config/compiler:default_symbols",
"//build/config/compiler:no_rtti", "//build/config/compiler:no_rtti",
"//build/config/compiler:runtime_library", "//build/config/compiler:runtime_library",
] ]
...@@ -441,7 +421,6 @@ if (is_linux) { ...@@ -441,7 +421,6 @@ if (is_linux) {
} else if (is_mac) { } else if (is_mac) {
_native_compiler_configs += [ "//build/config/mac:sdk" ] _native_compiler_configs += [ "//build/config/mac:sdk" ]
} else if (is_ios) { } else if (is_ios) {
_native_compiler_configs += [ "//build/config/ios:sdk" ]
} else if (is_android) { } else if (is_android) {
_native_compiler_configs += [ "//build/config/android:sdk" ] _native_compiler_configs += [ "//build/config/android:sdk" ]
} }
...@@ -453,41 +432,12 @@ if (is_clang && !is_nacl) { ...@@ -453,41 +432,12 @@ if (is_clang && !is_nacl) {
] ]
} }
# Optimizations and debug checking. # Debug/release-related defines.
if (is_debug) { if (is_debug) {
_native_compiler_configs += [ "//build/config:debug" ] _native_compiler_configs += [ "//build/config:debug" ]
_default_optimization_config = "//build/config/compiler:no_optimize"
} else { } else {
_native_compiler_configs += [ "//build/config:release" ] _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. # Windows linker setup for EXEs and DLLs.
if (is_win) { if (is_win) {
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
import("//build/config/android/config.gni") import("//build/config/android/config.gni")
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/toolchain/ccache.gni")
if (current_cpu == "arm") { if (current_cpu == "arm") {
import("//build/config/arm.gni") import("//build/config/arm.gni")
} }
...@@ -17,9 +20,6 @@ if (is_win) { ...@@ -17,9 +20,6 @@ if (is_win) {
import("//build/config/win/visual_studio_version.gni") import("//build/config/win/visual_studio_version.gni")
} }
import("//build/toolchain/ccache.gni")
import("//build/config/sanitizers/sanitizers.gni")
declare_args() { declare_args() {
# Normally, Android builds are lightly optimized, even for debug builds, to # Normally, Android builds are lightly optimized, even for debug builds, to
# keep binary size down. Setting this flag to true disables such optimization # keep binary size down. Setting this flag to true disables such optimization
...@@ -84,11 +84,6 @@ config("default_include_dirs") { ...@@ -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 --------------------------------------------------------------------- # compiler ---------------------------------------------------------------------
# #
# Base compiler configuration. # Base compiler configuration.
...@@ -1211,14 +1206,15 @@ config("no_incompatible_pointer_warnings") { ...@@ -1211,14 +1206,15 @@ config("no_incompatible_pointer_warnings") {
# Optimization ----------------------------------------------------------------- # Optimization -----------------------------------------------------------------
# #
# Note that BUILDCONFIG.gn sets up a variable "default_optimization_config" # The BUILDCONFIG file sets the "default_optimization" config on targets by
# which it will assign to the config it implicitly applies to every target. If # default. It will be equivalent to either "optimize" (release) or
# you want to override the optimization level for your target, remove this # "no_optimize" (debug) optimization configs.
# config (which will expand differently for debug or release builds), and then
# add back the one you want to override it with:
# #
# configs -= default_optimization_config # You can override the optimization level on a per-target basis by removing the
# configs += [ "//build/config/compiler/optimize_max" ] # default config and then adding the named one you want:
#
# configs -= [ "//build/config/compiler:default_optimization" ]
# configs += [ "//build/config/compiler:optimize_max" ]
# Shared settings for both "optimize" and "optimize_max" configs. # Shared settings for both "optimize" and "optimize_max" configs.
# IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags. # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags.
...@@ -1301,43 +1297,57 @@ if (is_win) { ...@@ -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
config("optimize") { # "default_optimization" config can re-use these settings.
if (is_win) { if (is_win) {
# Favor size over speed, /O1 must be before the common flags. The GYP # 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. # build also specifies /Os and /GF but these are implied by /O1.
cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ] optimize_cflags = [ "/O1" ] + common_optimize_on_cflags + [ "/Oi" ]
} else if (is_android || is_ios) { } else if (is_android || is_ios) {
cflags = [ "-Os" ] + common_optimize_on_cflags # Favor size over speed. # Favor size over speed.
} else { optimize_cflags = [ "-Os" ] + common_optimize_on_cflags
cflags = [ "-O2" ] + common_optimize_on_cflags } else {
} # Linux & Mac favor speed over size.
ldflags = common_optimize_on_ldflags # 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
# Turn off optimizations. config("optimize") {
config("no_optimize") { cflags = optimize_cflags
if (is_win) { ldflags = optimize_ldflags
cflags = [ }
# 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. "/Od", # Disable optimization.
"/Ob0", # Disable all inlining (on by default). "/Ob0", # Disable all inlining (on by default).
"/RTC1", # Runtime checks for stack frame and uninitialized variables. "/RTC1", # Runtime checks for stack frame and uninitialized variables.
] ]
} else if (is_android && !android_full_debug) { no_optimize_ldflags = []
} else if (is_android && !android_full_debug) {
# On Android we kind of optimize some things that don't affect debugging # 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. # much even when optimization is disabled to get the binary size down.
cflags = [ no_optimize_cflags = [
"-Os", "-Os",
"-fdata-sections", "-fdata-sections",
"-ffunction-sections", "-ffunction-sections",
] ]
if (!using_sanitizer) { if (!using_sanitizer) {
cflags += [ "-fomit-frame-pointer" ] no_optimize_cflags += [ "-fomit-frame-pointer" ]
}
ldflags = common_optimize_on_ldflags
} else {
cflags = [ "-O0" ]
} }
no_optimize_ldflags = common_optimize_on_ldflags
} else {
no_optimize_cflags = [ "-O0" ]
no_optimize_ldflags = []
}
config("no_optimize") {
cflags = no_optimize_cflags
ldflags = no_optimize_ldflags
} }
# Turns up the optimization level. On Windows, this implies whole program # Turns up the optimization level. On Windows, this implies whole program
...@@ -1368,53 +1378,105 @@ config("optimize_max") { ...@@ -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 ---------------------------------------------------------------------- # Symbols ----------------------------------------------------------------------
config("symbols") { # The BUILDCONFIG file sets the "default_symbols" config on targets by
if (is_win) { # 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") import("//build/toolchain/goma.gni")
if (use_goma) { if (use_goma) {
cflags = [ "/Z7" ] # No PDB file symbols_cflags = [ "/Z7" ] # No PDB file
} else { } else {
cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. symbols_cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
} }
if (is_win_fastlink) { if (is_win_fastlink) {
# Tell VS 2015+ to create a PDB that references debug # Tell VS 2015+ to create a PDB that references debug
# information in .obj and .lib files instead of copying # information in .obj and .lib files instead of copying
# it all. This flag is incompatible with /PROFILE # it all. This flag is incompatible with /PROFILE
ldflags = [ "/DEBUG:FASTLINK" ] symbols_ldflags = [ "/DEBUG:FASTLINK" ]
} else { } else {
ldflags = [ "/DEBUG" ] symbols_ldflags = [ "/DEBUG" ]
} }
} else { } else {
cflags = [ "-g2" ] symbols_cflags = [ "-g2" ]
if (use_debug_fission) { if (use_debug_fission) {
cflags += [ "-gsplit-dwarf" ] symbols_cflags += [ "-gsplit-dwarf" ]
}
} }
symbols_ldflags = []
} }
config("minimal_symbols") { config("symbols") {
if (is_win) { cflags = symbols_cflags
ldflags = symbols_ldflags
}
# Minimal symbols.
if (is_win) {
# Linker symbols for backtraces only. # Linker symbols for backtraces only.
minimal_symbols_cflags = []
if (is_win_fastlink) { if (is_win_fastlink) {
# Tell VS 2015+ to create a PDB that references debug # Tell VS 2015+ to create a PDB that references debug
# information in .obj and .lib files instead of copying # information in .obj and .lib files instead of copying
# it all. This flag is incompatible with /PROFILE # it all. This flag is incompatible with /PROFILE
ldflags = [ "/DEBUG:FASTLINK" ] minimal_symbols_ldflags = [ "/DEBUG:FASTLINK" ]
} else { } else {
ldflags = [ "/DEBUG" ] minimal_symbols_ldflags = [ "/DEBUG" ]
} }
} else { } else {
cflags = [ "-g1" ] minimal_symbols_cflags = [ "-g1" ]
if (use_debug_fission) { if (use_debug_fission) {
cflags += [ "-gsplit-dwarf" ] 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") { config("no_symbols") {
if (!is_win) { cflags = no_symbols_cflags
cflags = [ "-g0" ] }
# 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)
} }
} }
# 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
}
}
...@@ -3,6 +3,18 @@ ...@@ -3,6 +3,18 @@
# found in the LICENSE file. # found in the LICENSE file.
declare_args() { 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 # Use libc++ (buildtools/third_party/libc++ and
# buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
# This is intended to be used for instrumented builds. # This is intended to be used for instrumented builds.
...@@ -32,6 +44,12 @@ declare_args() { ...@@ -32,6 +44,12 @@ declare_args() {
use_cfi_diag = false 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 # 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 # 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. # whether it links, one would normally never run a sanitizer in debug mode.
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/compiler/compiler.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/visual_studio_version.gni") import("//build/config/win/visual_studio_version.gni")
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# Do not use the targets in this file unless you need a certain libjpeg # Do not use the targets in this file unless you need a certain libjpeg
# implementation. Use the meta target //third_party:jpeg instead. # implementation. Use the meta target //third_party:jpeg instead.
import("//build/config/sanitizers/sanitizers.gni")
if (current_cpu == "arm") { if (current_cpu == "arm") {
import("//build/config/arm.gni") import("//build/config/arm.gni")
} }
......
...@@ -532,7 +532,7 @@ component("cc") { ...@@ -532,7 +532,7 @@ component("cc") {
defines = [ "CC_IMPLEMENTATION=1" ] defines = [ "CC_IMPLEMENTATION=1" ]
if (!is_debug && (is_win || is_android)) { if (!is_debug && (is_win || is_android)) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
......
...@@ -48,7 +48,7 @@ source_set("base") { ...@@ -48,7 +48,7 @@ source_set("base") {
defines = [ "CC_IMPLEMENTATION=1" ] defines = [ "CC_IMPLEMENTATION=1" ]
if (!is_debug && (is_win || is_android)) { if (!is_debug && (is_win || is_android)) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
...@@ -57,7 +57,7 @@ component("surfaces") { ...@@ -57,7 +57,7 @@ component("surfaces") {
] ]
if (is_android && !is_debug) { if (is_android && !is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//chrome/version.gni") import("//chrome/version.gni")
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/crypto.gni") import("//build/config/crypto.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
declare_args() { declare_args() {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//build/config/win/manifest.gni") import("//build/config/win/manifest.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
......
...@@ -161,7 +161,7 @@ source_set("service_sources") { ...@@ -161,7 +161,7 @@ source_set("service_sources") {
if (is_android && !is_debug) { if (is_android && !is_debug) {
# On Android optimize more since this component can be a bottleneck. # 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" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/compiler/compiler.gni")
import("//build/config/crypto.gni") import("//build/config/crypto.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
......
...@@ -489,7 +489,7 @@ component("skia") { ...@@ -489,7 +489,7 @@ component("skia") {
} }
if (is_android && !is_debug) { if (is_android && !is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
...@@ -590,7 +590,7 @@ source_set("skia_opts") { ...@@ -590,7 +590,7 @@ source_set("skia_opts") {
} }
if (is_android && !is_debug) { if (is_android && !is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/sanitizers/sanitizers.gni")
# Config for us and everybody else depending on BoringSSL. # Config for us and everybody else depending on BoringSSL.
config("openssl_config") { config("openssl_config") {
include_dirs = [] include_dirs = []
......
...@@ -41,11 +41,7 @@ source_set("brotli") { ...@@ -41,11 +41,7 @@ source_set("brotli") {
] ]
# Since we are never debug brotli, freeze the optimizations to -O2. # Since we are never debug brotli, freeze the optimizations to -O2.
if (is_debug) { configs -= [ "//build/config/compiler:default_optimization" ]
configs -= [ "//build/config/compiler:no_optimize" ]
} else {
configs -= [ "//build/config/compiler:optimize" ]
}
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
include_dirs = [ "dec" ] include_dirs = [ "dec" ]
......
...@@ -99,7 +99,7 @@ source_set("opus") { ...@@ -99,7 +99,7 @@ source_set("opus") {
if (!is_debug && is_posix && if (!is_debug && is_posix &&
(current_cpu == "arm" || current_cpu == "arm64")) { (current_cpu == "arm" || current_cpu == "arm64")) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
......
...@@ -166,7 +166,7 @@ places are noted in the table below. ...@@ -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` (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_neon_optional` (0/1) | `arm_optionally_use_neon` (true/false) | `//build/config/arm.gni` |
| `arm_version` | `arm_version` | `//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` | | `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=="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`) | | `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. ...@@ -177,22 +177,22 @@ places are noted in the table below.
| `component` ("shared_library"/"static_library") | `is_component_build` (true/false) | (global) | | `component` ("shared_library"/"static_library") | `is_component_build` (true/false) | (global) |
| `desktop_linux` (0/1) | `is_desktop_linux` (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`) | | `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` | | `gomadir` | `goma_dir` | `//build/toolchain/goma.gni` |
| `ios_deployment_target` (string) | `ios_deployment_target` | `//build/config/ios/ios_sdk.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_OVERRIDE_PATH` environment variable | `visual_studio_path` | `//build/config/win/visual_studio_version.gni` |
| `GYP_MSVS_VERSION` environment variable | (none) | | | `GYP_MSVS_VERSION` environment variable | (none) | |
| `ios_sdk_path` | `ios_sdk_path` and `use_ios_simulator` | `//build/config/ios/ios_sdk.gni` | | `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_min` | `mac_sdk_min` | `//build/config/mac/mac_sdk.gni` |
| `mac_sdk_path` | `mac_sdk_path` | `//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` | | `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` | | `SDKROOT` (Mac) | `sysroot` | `//build/config/sysroot.gni` |
| `sysroot` | `sysroot` | `//build/config/sysroot.gni` | | `sysroot` | `sysroot` | `//build/config/sysroot.gni` |
| `target_arch` ("ia32"/"x64"/"arm"/"mipsel") | `target_arch` ("x86"/"x64"/"arm"/"mipsel") | (global) | | `target_arch` ("ia32"/"x64"/"arm"/"mipsel") | `target_arch` ("x86"/"x64"/"arm"/"mipsel") | (global) |
| `toolkit_views` (0/1) | `toolkit_views` | `//build/config/ui.gni` | | `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`) | | `windows_sdk_path` | `windows_sdk_path` | (internal to `//build/config/win/BUILD.gn`) |
### Feature flags ### Feature flags
...@@ -572,7 +572,7 @@ get the same behavior in GN, do: ...@@ -572,7 +572,7 @@ get the same behavior in GN, do:
``` ```
if (!is_debug && is_win) { if (!is_debug && is_win) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
``` ```
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/compiler/compiler.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//testing/test.gni") import("//testing/test.gni")
......
...@@ -329,7 +329,7 @@ component("gfx") { ...@@ -329,7 +329,7 @@ component("gfx") {
} }
if (!is_debug) { if (!is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
......
...@@ -61,7 +61,7 @@ component("geometry") { ...@@ -61,7 +61,7 @@ component("geometry") {
] ]
if (is_android && !is_debug) { if (is_android && !is_debug) {
configs -= [ "//build/config/compiler:optimize" ] configs -= [ "//build/config/compiler:default_optimization" ]
configs += [ "//build/config/compiler:optimize_max" ] configs += [ "//build/config/compiler:optimize_max" ]
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment