Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2119)

Unified Diff: build/config/compiler/BUILD.gn

Issue 2645323002: Add support for configurable -OX optimization levels for debug builds (Closed)
Patch Set: Move --debug-opt-level after --no-clang in tools/gn.py Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/compiler/BUILD.gn
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index ab45443d08cea097441a1bb1d4686fb55ba4a17b..82761c34441f91058a5f5887bfb2ae2f27fbdf20 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -2,6 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+declare_args() {
+ # The optimization level to use for debug builds.
+ if (is_android) {
+ # 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.
+ debug_optimization_level = "s"
+ } else {
+ debug_optimization_level = "2"
+ }
+}
+
import("//build/config/android/config.gni")
if (current_cpu == "arm") {
import("//build/config/arm.gni")
@@ -743,21 +754,21 @@ config("no_optimize") {
# The only difference on windows is that the inlining is less aggressive.
# (We accept the default level). Otherwise it is very slow.
cflags = [
- "/O2", # Do some optimizations.
+ "/O${debug_optimization_level}", # Do some optimizations.
"/Oy-", # Disable omitting frame pointers, must be after /O2.
]
} else if (is_android) {
# 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",
+ "-O${debug_optimization_level}",
"-fdata-sections",
"-ffunction-sections",
]
ldflags = common_optimize_on_ldflags
} else {
cflags = [
- "-O2",
+ "-O${debug_optimization_level}",
"-fdata-sections",
"-ffunction-sections",
]
« no previous file with comments | « no previous file | runtime/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698