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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 ] | 1249 ] |
1253 if (full_wpo_on_official) { | 1250 if (full_wpo_on_official) { |
1254 arflags = [ "/LTCG" ] | 1251 arflags = [ "/LTCG" ] |
1255 } | 1252 } |
1256 } | 1253 } |
1257 } else { | 1254 } else { |
1258 common_optimize_on_cflags = [] | 1255 common_optimize_on_cflags = [] |
1259 common_optimize_on_ldflags = [] | 1256 common_optimize_on_ldflags = [] |
1260 | 1257 |
1261 if (is_android) { | 1258 if (is_android) { |
1262 # We don't omit frame pointers on arm64 since they are required | |
1263 # to correctly unwind stackframes which contain system library | |
1264 # function frames (crbug.com/391706). | |
1265 if (!using_sanitizer && !enable_profiling && current_cpu != "arm64") { | |
1266 common_optimize_on_cflags += [ "-fomit-frame-pointer" ] | |
1267 } | |
1268 | |
1269 # TODO(jdduke) Re-enable on mips after resolving linking | 1259 # TODO(jdduke) Re-enable on mips after resolving linking |
1270 # issues with libc++ (crbug.com/456380). | 1260 # issues with libc++ (crbug.com/456380). |
1271 if (current_cpu != "mipsel" && current_cpu != "mips64el") { | 1261 if (current_cpu != "mipsel" && current_cpu != "mips64el") { |
1272 common_optimize_on_ldflags += [ | 1262 common_optimize_on_ldflags += [ |
1273 # Warn in case of text relocations. | 1263 # Warn in case of text relocations. |
1274 "-Wl,--warn-shared-textrel", | 1264 "-Wl,--warn-shared-textrel", |
1275 ] | 1265 ] |
1276 } | 1266 } |
1277 } | 1267 } |
1278 | 1268 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 "-Wl,--no-as-needed", | 1303 "-Wl,--no-as-needed", |
1314 "-lpthread", | 1304 "-lpthread", |
1315 ] | 1305 ] |
1316 } | 1306 } |
1317 common_optimize_on_ldflags += [ "-Wl,--as-needed" ] | 1307 common_optimize_on_ldflags += [ "-Wl,--as-needed" ] |
1318 } | 1308 } |
1319 } | 1309 } |
1320 } | 1310 } |
1321 | 1311 |
1322 config("default_stack_frames") { | 1312 config("default_stack_frames") { |
| 1313 if (is_posix && !(is_mac || is_ios)) { |
| 1314 if (using_sanitizer || enable_profiling || is_debug || |
| 1315 current_cpu == "arm64") { |
| 1316 # Explicitly ask for frame pointers, otherwise: |
| 1317 # * Stacks may be missing for sanitizer and profiling builds. |
| 1318 # * Debug tcmalloc can crash (crbug.com/636489). |
| 1319 # * Stacks may be missing for arm64 crash dumps (crbug.com/391706). |
| 1320 cflags = [ "-fno-omit-frame-pointer" ] |
| 1321 } else if (is_android) { |
| 1322 cflags = [ "-fomit-frame-pointer" ] |
| 1323 } |
| 1324 } |
1323 } | 1325 } |
1324 | 1326 |
1325 # Default "optimization on" config. | 1327 # Default "optimization on" config. |
1326 config("optimize") { | 1328 config("optimize") { |
1327 if (is_win) { | 1329 if (is_win) { |
1328 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 | 1330 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 |
1329 if (is_official_build && full_wpo_on_official && !is_clang) { | 1331 if (is_official_build && full_wpo_on_official && !is_clang) { |
1330 common_optimize_on_cflags += [ | 1332 common_optimize_on_cflags += [ |
1331 "/GL", # Whole program optimization. | 1333 "/GL", # Whole program optimization. |
1332 | 1334 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 ] | 1376 ] |
1375 } else if (is_android && !android_full_debug) { | 1377 } else if (is_android && !android_full_debug) { |
1376 # On Android we kind of optimize some things that don't affect debugging | 1378 # On Android we kind of optimize some things that don't affect debugging |
1377 # much even when optimization is disabled to get the binary size down. | 1379 # much even when optimization is disabled to get the binary size down. |
1378 cflags = [ | 1380 cflags = [ |
1379 "-Os", | 1381 "-Os", |
1380 "-fdata-sections", | 1382 "-fdata-sections", |
1381 "-ffunction-sections", | 1383 "-ffunction-sections", |
1382 ] | 1384 ] |
1383 | 1385 |
1384 # We don't omit frame pointers on arm64 since they are required | |
1385 # to correctly unwind stackframes which contain system library | |
1386 # function frames (crbug.com/391706). | |
1387 if (!using_sanitizer && !enable_profiling && current_cpu != "arm64") { | |
1388 cflags += [ "-fomit-frame-pointer" ] | |
1389 } | |
1390 | |
1391 # Don't use gc-sections since it can cause links to succeed when they | 1386 # Don't use gc-sections since it can cause links to succeed when they |
1392 # actually shouldn't. http://crbug.com/159847 | 1387 # actually shouldn't. http://crbug.com/159847 |
1393 ldflags = common_optimize_on_ldflags - [ "-Wl,--gc-sections" ] | 1388 ldflags = common_optimize_on_ldflags - [ "-Wl,--gc-sections" ] |
1394 } else { | 1389 } else { |
1395 cflags = [ "-O0" ] | 1390 cflags = [ "-O0" ] |
1396 ldflags = [] | 1391 ldflags = [] |
1397 } | 1392 } |
1398 } | 1393 } |
1399 | 1394 |
1400 # Turns up the optimization level. On Windows, this implies whole program | 1395 # Turns up the optimization level. On Windows, this implies whole program |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 | 1587 |
1593 if (is_ios || is_mac) { | 1588 if (is_ios || is_mac) { |
1594 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1589 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1595 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1590 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1596 config("enable_arc") { | 1591 config("enable_arc") { |
1597 common_flags = [ "-fobjc-arc" ] | 1592 common_flags = [ "-fobjc-arc" ] |
1598 cflags_objc = common_flags | 1593 cflags_objc = common_flags |
1599 cflags_objcc = common_flags | 1594 cflags_objcc = common_flags |
1600 } | 1595 } |
1601 } | 1596 } |
OLD | NEW |