Index: build/config/compiler/BUILD.gn |
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
index 9583f779dfff6f1ae3a7c14f00a5c384789b2852..3cf72220237662772be19973c54a9c9de54012fd 100644 |
--- a/build/config/compiler/BUILD.gn |
+++ b/build/config/compiler/BUILD.gn |
@@ -80,6 +80,12 @@ declare_args() { |
# If true, gold linker will save symbol table inside object files. |
# This speeds up gdb startup by 60% |
gdb_index = false |
+ |
+ # If true, optimize for size. Does not affect windows builds. |
+ # 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_for_size = is_android || is_ios |
} |
# Apply the default logic for these values if they were not set explicitly. |
@@ -1209,13 +1215,10 @@ config("optimize") { |
# 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) { |
+ } else if (optimize_for_size) { |
# Favor size over speed. |
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. |
cflags = [ "-O2" ] + common_optimize_on_cflags |
} |
ldflags = common_optimize_on_ldflags |