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

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 2782063005: Explicitly specify whether to emit frame pointers by default. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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/chromecast_build.gni") 7 import("//build/config/chromecast_build.gni")
8 import("//build/config/compiler/compiler.gni") 8 import("//build/config/compiler/compiler.gni")
9 import("//build/config/nacl/config.gni") 9 import("//build/config/nacl/config.gni")
10 import("//build/toolchain/cc_wrapper.gni") 10 import("//build/toolchain/cc_wrapper.gni")
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 # default config and then adding the named one you want: 1287 # default config and then adding the named one you want:
1288 # 1288 #
1289 # configs -= [ "//build/config/compiler:default_optimization" ] 1289 # configs -= [ "//build/config/compiler:default_optimization" ]
1290 # configs += [ "//build/config/compiler:optimize_max" ] 1290 # configs += [ "//build/config/compiler:optimize_max" ]
1291 1291
1292 # Shared settings for both "optimize" and "optimize_max" configs. 1292 # Shared settings for both "optimize" and "optimize_max" configs.
1293 # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags. 1293 # IMPORTANT: On Windows "/O1" and "/O2" must go before the common flags.
1294 if (is_win) { 1294 if (is_win) {
1295 common_optimize_on_cflags = [ 1295 common_optimize_on_cflags = [
1296 "/Ob2", # Both explicit and auto inlining. 1296 "/Ob2", # Both explicit and auto inlining.
1297 "/Oy-", # Disable omitting frame pointers, must be after /O2.
1298 "/d2Zi+", # Improve debugging of optimized code. 1297 "/d2Zi+", # Improve debugging of optimized code.
1299 "/Zc:inline", # Remove unreferenced COMDAT (faster links). 1298 "/Zc:inline", # Remove unreferenced COMDAT (faster links).
1300 ] 1299 ]
1301 if (!is_asan) { 1300 if (!is_asan) {
1302 common_optimize_on_cflags += [ 1301 common_optimize_on_cflags += [
1303 # Put data in separate COMDATs. This allows the linker 1302 # Put data in separate COMDATs. This allows the linker
1304 # to put bit-identical constants at the same address even if 1303 # to put bit-identical constants at the same address even if
1305 # they're unrelated constants, which saves binary size. 1304 # they're unrelated constants, which saves binary size.
1306 # This optimization can't be used when ASan is enabled because 1305 # This optimization can't be used when ASan is enabled because
1307 # it is not compatible with the ASan ODR checker. 1306 # it is not compatible with the ASan ODR checker.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1377 common_optimize_on_ldflags += [ 1376 common_optimize_on_ldflags += [
1378 # Specifically tell the linker to perform optimizations. 1377 # Specifically tell the linker to perform optimizations.
1379 # See http://lwn.net/Articles/192624/ . 1378 # See http://lwn.net/Articles/192624/ .
1380 "-Wl,-O1", 1379 "-Wl,-O1",
1381 "-Wl,--gc-sections", 1380 "-Wl,--gc-sections",
1382 ] 1381 ]
1383 } 1382 }
1384 } 1383 }
1385 1384
1386 config("default_stack_frames") { 1385 config("default_stack_frames") {
1387 if (is_posix && !(is_mac || is_ios)) { 1386 if (is_posix) {
1388 if (using_sanitizer || enable_profiling || is_debug || 1387 if (enabled_frame_pointers) {
1389 current_cpu == "arm64") {
1390 # Explicitly ask for frame pointers, otherwise:
1391 # * Stacks may be missing for sanitizer and profiling builds.
1392 # * Debug tcmalloc can crash (crbug.com/636489).
1393 # * Stacks may be missing for arm64 crash dumps (crbug.com/391706).
1394 cflags = [ "-fno-omit-frame-pointer" ] 1388 cflags = [ "-fno-omit-frame-pointer" ]
1395 } else if (is_android) { 1389 } else {
1396 cflags = [ "-fomit-frame-pointer" ] 1390 cflags = [ "-fomit-frame-pointer" ]
Mark Mentovai 2017/03/30 23:43:29 I think we’d never want this in a debug-ish config
erikchen 2017/04/03 06:33:39 I'm just maintaining the previous behavior.
1397 } 1391 }
1398 } 1392 }
1393
1394 if (is_win) {
1395 if (enabled_frame_pointers) {
1396 common_optimize_on_cflags += [ "/Oy-" ] # Disable omitting frame pointers , must be after /O2.
1397 } else {
1398 common_optimize_on_cflags += [ "/Oy" ]
1399 }
1400 }
1399 } 1401 }
1400 1402
1401 # Default "optimization on" config. 1403 # Default "optimization on" config.
1402 config("optimize") { 1404 config("optimize") {
1403 if (is_win) { 1405 if (is_win) {
1404 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 1406 # TODO(thakis): Remove is_clang here, https://crbug.com/598772
1405 if (is_official_build && full_wpo_on_official && !is_clang) { 1407 if (is_official_build && full_wpo_on_official && !is_clang) {
1406 common_optimize_on_cflags += [ 1408 common_optimize_on_cflags += [
1407 "/GL", # Whole program optimization. 1409 "/GL", # Whole program optimization.
1408 1410
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 1717
1716 if (is_ios || is_mac) { 1718 if (is_ios || is_mac) {
1717 # On Mac and iOS, this enables support for ARC (automatic ref-counting). 1719 # On Mac and iOS, this enables support for ARC (automatic ref-counting).
1718 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. 1720 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html.
1719 config("enable_arc") { 1721 config("enable_arc") {
1720 common_flags = [ "-fobjc-arc" ] 1722 common_flags = [ "-fobjc-arc" ]
1721 cflags_objc = common_flags 1723 cflags_objc = common_flags
1722 cflags_objcc = common_flags 1724 cflags_objcc = common_flags
1723 } 1725 }
1724 } 1726 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698