Chromium Code Reviews| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 # This is here so that all files get recompiled after a clang roll and | 224 # This is here so that all files get recompiled after a clang roll and |
| 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 || is_debug) { |
| 235 # Explicitly ask for frame pointers. Otherwise they are omitted when | 235 # Explicitly ask for frame pointers, otherwise they are omitted when |
| 236 # any optimization level is used (and Android debug builds use -Os). | 236 # any optimization level is used (Android debug builds use -Os.) |
| 237 # This prevents stack frames from working when profiling, and can cause | |
| 238 # crashes when unwinding stack frames (crbug.com/636489). | |
|
Dirk Pranke
2016/08/22 20:03:48
Do we have any idea what the perf impact of -fno-o
vmiura
2016/08/22 20:32:04
I don't have data but I expect the impact is fairl
| |
| 237 cflags += [ "-fno-omit-frame-pointer" ] | 239 cflags += [ "-fno-omit-frame-pointer" ] |
| 240 | |
| 238 if (!is_debug) { | 241 if (!is_debug) { |
| 239 cflags += [ "-g" ] | 242 cflags += [ "-g" ] |
| 240 | 243 |
| 241 if (enable_full_stack_frames_for_profiling) { | 244 if (enable_full_stack_frames_for_profiling) { |
| 242 cflags += [ | 245 cflags += [ |
| 243 "-fno-inline", | 246 "-fno-inline", |
| 244 "-fno-optimize-sibling-calls", | 247 "-fno-optimize-sibling-calls", |
| 245 ] | 248 ] |
| 246 } | 249 } |
| 247 } | 250 } |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1267 # Don't emit the GCC version ident directives, they just end up in the | 1270 # Don't emit the GCC version ident directives, they just end up in the |
| 1268 # .comment section taking up binary size. | 1271 # .comment section taking up binary size. |
| 1269 "-fno-ident", | 1272 "-fno-ident", |
| 1270 | 1273 |
| 1271 # Put data and code in their own sections, so that unused symbols | 1274 # Put data and code in their own sections, so that unused symbols |
| 1272 # can be removed at link time with --gc-sections. | 1275 # can be removed at link time with --gc-sections. |
| 1273 "-fdata-sections", | 1276 "-fdata-sections", |
| 1274 "-ffunction-sections", | 1277 "-ffunction-sections", |
| 1275 ] | 1278 ] |
| 1276 | 1279 |
| 1280 if (is_debug) { | |
| 1281 # Explicitly ask for frame pointers, otherwise they are omitted when | |
| 1282 # any optimization level is used and can cause crashes when unwinding | |
| 1283 # stack frames (crbug.com/636489). | |
| 1284 common_optimize_on_cflags += [ "-fno-omit-frame-pointer" ] | |
| 1285 } | |
| 1286 | |
| 1277 common_optimize_on_ldflags += [ | 1287 common_optimize_on_ldflags += [ |
| 1278 # Specifically tell the linker to perform optimizations. | 1288 # Specifically tell the linker to perform optimizations. |
| 1279 # See http://lwn.net/Articles/192624/ . | 1289 # See http://lwn.net/Articles/192624/ . |
| 1280 "-Wl,-O1", | 1290 "-Wl,-O1", |
| 1281 "-Wl,--gc-sections", | 1291 "-Wl,--gc-sections", |
| 1282 ] | 1292 ] |
| 1283 | 1293 |
| 1284 if (!using_sanitizer) { | 1294 if (!using_sanitizer) { |
| 1285 # Functions interposed by the sanitizers can make ld think | 1295 # Functions interposed by the sanitizers can make ld think |
| 1286 # that some libraries aren't needed when they actually are, | 1296 # that some libraries aren't needed when they actually are, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1568 | 1578 |
| 1569 if (is_ios || is_mac) { | 1579 if (is_ios || is_mac) { |
| 1570 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1580 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
| 1571 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1581 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
| 1572 config("enable_arc") { | 1582 config("enable_arc") { |
| 1573 common_flags = [ "-fobjc-arc" ] | 1583 common_flags = [ "-fobjc-arc" ] |
| 1574 cflags_objc = common_flags | 1584 cflags_objc = common_flags |
| 1575 cflags_objcc = common_flags | 1585 cflags_objcc = common_flags |
| 1576 } | 1586 } |
| 1577 } | 1587 } |
| OLD | NEW |