OLD | NEW |
---|---|
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/chrome_build.gni") | 6 import("//build/config/chrome_build.gni") |
7 import("//build/config/compiler/compiler.gni") | 7 import("//build/config/compiler/compiler.gni") |
8 import("//build/config/nacl/config.gni") | 8 import("//build/config/nacl/config.gni") |
9 import("//build/toolchain/cc_wrapper.gni") | 9 import("//build/toolchain/cc_wrapper.gni") |
10 import("//build/toolchain/toolchain.gni") | 10 import("//build/toolchain/toolchain.gni") |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 # when turning clang on or off. (defines are passed via the command line, | 225 # when turning clang on or off. (defines are passed via the command line, |
226 # and build system rebuild things when their commandline changes). Nothing | 226 # and build system rebuild things when their commandline changes). Nothing |
227 # should ever read this define. | 227 # should ever read this define. |
228 defines += [ "CR_CLANG_REVISION=$clang_revision" ] | 228 defines += [ "CR_CLANG_REVISION=$clang_revision" ] |
229 } | 229 } |
230 | 230 |
231 # Non-Mac Posix compiler flags setup. | 231 # Non-Mac Posix compiler flags setup. |
232 # ----------------------------------- | 232 # ----------------------------------- |
233 if (is_posix && !(is_mac || is_ios)) { | 233 if (is_posix && !(is_mac || is_ios)) { |
234 if (enable_profiling) { | 234 if (enable_profiling) { |
235 # Explicitly ask for frame pointers. Otherwise they are omitted when | |
236 # any optimization level is used (and Android debug builds use -Os). | |
237 cflags += [ "-fno-omit-frame-pointer" ] | |
238 if (!is_debug) { | 235 if (!is_debug) { |
239 cflags += [ "-g" ] | 236 cflags += [ "-g" ] |
240 | 237 |
241 if (enable_full_stack_frames_for_profiling) { | 238 if (enable_full_stack_frames_for_profiling) { |
242 cflags += [ | 239 cflags += [ |
243 "-fno-inline", | 240 "-fno-inline", |
244 "-fno-optimize-sibling-calls", | 241 "-fno-optimize-sibling-calls", |
245 ] | 242 ] |
246 } | 243 } |
247 } | 244 } |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1231 ] | 1228 ] |
1232 if (full_wpo_on_official) { | 1229 if (full_wpo_on_official) { |
1233 arflags = [ "/LTCG" ] | 1230 arflags = [ "/LTCG" ] |
1234 } | 1231 } |
1235 } | 1232 } |
1236 } else { | 1233 } else { |
1237 common_optimize_on_cflags = [] | 1234 common_optimize_on_cflags = [] |
1238 common_optimize_on_ldflags = [] | 1235 common_optimize_on_ldflags = [] |
1239 | 1236 |
1240 if (is_android) { | 1237 if (is_android) { |
1241 # We don't omit frame pointers on arm64 since they are required | |
1242 # to correctly unwind stackframes which contain system library | |
1243 # function frames (crbug.com/391706). | |
1244 if (!using_sanitizer && !enable_profiling && current_cpu != "arm64") { | |
1245 common_optimize_on_cflags += [ "-fomit-frame-pointer" ] | |
1246 } | |
1247 | |
1248 # TODO(jdduke) Re-enable on mips after resolving linking | 1238 # TODO(jdduke) Re-enable on mips after resolving linking |
1249 # issues with libc++ (crbug.com/456380). | 1239 # issues with libc++ (crbug.com/456380). |
1250 if (current_cpu != "mipsel" && current_cpu != "mips64el") { | 1240 if (current_cpu != "mipsel" && current_cpu != "mips64el") { |
1251 common_optimize_on_ldflags += [ | 1241 common_optimize_on_ldflags += [ |
1252 # Warn in case of text relocations. | 1242 # Warn in case of text relocations. |
1253 "-Wl,--warn-shared-textrel", | 1243 "-Wl,--warn-shared-textrel", |
1254 ] | 1244 ] |
1255 } | 1245 } |
1256 } | 1246 } |
1257 | 1247 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1291 common_optimize_on_ldflags += [ | 1281 common_optimize_on_ldflags += [ |
1292 "-Wl,--no-as-needed", | 1282 "-Wl,--no-as-needed", |
1293 "-lpthread", | 1283 "-lpthread", |
1294 ] | 1284 ] |
1295 } | 1285 } |
1296 common_optimize_on_ldflags += [ "-Wl,--as-needed" ] | 1286 common_optimize_on_ldflags += [ "-Wl,--as-needed" ] |
1297 } | 1287 } |
1298 } | 1288 } |
1299 } | 1289 } |
1300 | 1290 |
1291 config("default_stack_frames") { | |
1292 if (is_posix && !(is_mac || is_ios)) { | |
1293 if (using_sanitizer || enable_profiling || is_debug || | |
brettw
2016/08/24 18:27:02
This is still different from the old code on Andro
vmiura
2016/08/24 18:47:26
I may be missing a nuance, but I'm intentionally m
| |
1294 current_cpu == "arm64") { | |
1295 # Explicitly ask for frame pointers, otherwise: | |
1296 # * Stacks may be missing for sanitizer and profiling builds. | |
1297 # * Debug tcmalloc can crash (crbug.com/636489). | |
1298 # * Stacks may be missing for arm64 crash dumps (crbug.com/391706). | |
1299 cflags = [ "-fno-omit-frame-pointer" ] | |
1300 } else if (is_android) { | |
1301 cflags = [ "-fomit-frame-pointer" ] | |
brettw
2016/08/24 19:30:02
I mean this line. It used to not set this on the A
vmiura
2016/08/24 19:40:16
Thanks, yeah I think that 'android_full_debug' is
| |
1302 } | |
1303 } | |
1304 } | |
1305 | |
1301 # Default "optimization on" config. | 1306 # Default "optimization on" config. |
1302 config("optimize") { | 1307 config("optimize") { |
1303 if (is_win) { | 1308 if (is_win) { |
1304 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 | 1309 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 |
1305 if (is_official_build && full_wpo_on_official && !is_clang) { | 1310 if (is_official_build && full_wpo_on_official && !is_clang) { |
1306 common_optimize_on_cflags += [ | 1311 common_optimize_on_cflags += [ |
1307 "/GL", # Whole program optimization. | 1312 "/GL", # Whole program optimization. |
1308 | 1313 |
1309 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. | 1314 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. |
1310 # Probably anything that this would catch that wouldn't be caught in a | 1315 # Probably anything that this would catch that wouldn't be caught in a |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1350 ] | 1355 ] |
1351 } else if (is_android && !android_full_debug) { | 1356 } else if (is_android && !android_full_debug) { |
1352 # On Android we kind of optimize some things that don't affect debugging | 1357 # On Android we kind of optimize some things that don't affect debugging |
1353 # much even when optimization is disabled to get the binary size down. | 1358 # much even when optimization is disabled to get the binary size down. |
1354 cflags = [ | 1359 cflags = [ |
1355 "-Os", | 1360 "-Os", |
1356 "-fdata-sections", | 1361 "-fdata-sections", |
1357 "-ffunction-sections", | 1362 "-ffunction-sections", |
1358 ] | 1363 ] |
1359 | 1364 |
1360 # We don't omit frame pointers on arm64 since they are required | |
1361 # to correctly unwind stackframes which contain system library | |
1362 # function frames (crbug.com/391706). | |
1363 if (!using_sanitizer && !enable_profiling && current_cpu != "arm64") { | |
1364 cflags += [ "-fomit-frame-pointer" ] | |
1365 } | |
1366 | |
1367 # Don't use gc-sections since it can cause links to succeed when they | 1365 # Don't use gc-sections since it can cause links to succeed when they |
1368 # actually shouldn't. http://crbug.com/159847 | 1366 # actually shouldn't. http://crbug.com/159847 |
1369 ldflags = common_optimize_on_ldflags - [ "-Wl,--gc-sections" ] | 1367 ldflags = common_optimize_on_ldflags - [ "-Wl,--gc-sections" ] |
1370 } else { | 1368 } else { |
1371 cflags = [ "-O0" ] | 1369 cflags = [ "-O0" ] |
1372 ldflags = [] | 1370 ldflags = [] |
1373 } | 1371 } |
1374 } | 1372 } |
1375 | 1373 |
1376 # Turns up the optimization level. On Windows, this implies whole program | 1374 # Turns up the optimization level. On Windows, this implies whole program |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1568 | 1566 |
1569 if (is_ios || is_mac) { | 1567 if (is_ios || is_mac) { |
1570 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1568 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1571 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1569 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1572 config("enable_arc") { | 1570 config("enable_arc") { |
1573 common_flags = [ "-fobjc-arc" ] | 1571 common_flags = [ "-fobjc-arc" ] |
1574 cflags_objc = common_flags | 1572 cflags_objc = common_flags |
1575 cflags_objcc = common_flags | 1573 cflags_objcc = common_flags |
1576 } | 1574 } |
1577 } | 1575 } |
OLD | NEW |