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 1225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 # This optimization can't be used when ASan is enabled because | 1236 # This optimization can't be used when ASan is enabled because |
1237 # it is not compatible with the ASan ODR checker. | 1237 # it is not compatible with the ASan ODR checker. |
1238 "/Gw", | 1238 "/Gw", |
1239 ] | 1239 ] |
1240 } | 1240 } |
1241 common_optimize_on_ldflags = [] | 1241 common_optimize_on_ldflags = [] |
1242 if (!is_component_build) { | 1242 if (!is_component_build) { |
1243 common_optimize_on_ldflags += [ "/OPT:ICF" ] # Redundant COMDAT folding. | 1243 common_optimize_on_ldflags += [ "/OPT:ICF" ] # Redundant COMDAT folding. |
1244 } | 1244 } |
1245 if (is_official_build) { | 1245 if (is_official_build) { |
1246 common_optimize_on_ldflags += [ | 1246 common_optimize_on_ldflags += [ "/OPT:REF" ] # Remove unreferenced data. |
1247 "/OPT:REF", # Remove unreferenced data. | 1247 if (!use_lld) { |
1248 "/LTCG", # Link-time code generation. | 1248 common_optimize_on_ldflags += [ |
| 1249 "/LTCG", # Link-time code generation. |
1249 | 1250 |
1250 # Set the number of LTCG code-gen threads to eight. The default is four. | 1251 # Set the number of LTCG code-gen threads to eight. The default is four. |
1251 # This gives a 5-10% link speedup. | 1252 # This gives a 5-10% link speedup. |
1252 "/cgthreads:8", | 1253 "/cgthreads:8", |
1253 ] | 1254 ] |
| 1255 } |
1254 if (full_wpo_on_official) { | 1256 if (full_wpo_on_official) { |
1255 arflags = [ "/LTCG" ] | 1257 arflags = [ "/LTCG" ] |
1256 } | 1258 } |
1257 } | 1259 } |
1258 } else { | 1260 } else { |
1259 common_optimize_on_cflags = [] | 1261 common_optimize_on_cflags = [] |
1260 common_optimize_on_ldflags = [] | 1262 common_optimize_on_ldflags = [] |
1261 | 1263 |
1262 if (is_android) { | 1264 if (is_android) { |
1263 # TODO(jdduke) Re-enable on mips after resolving linking | 1265 # TODO(jdduke) Re-enable on mips after resolving linking |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 # So this config has to have the selection logic just like | 1391 # So this config has to have the selection logic just like |
1390 # "default_optimization", below. | 1392 # "default_optimization", below. |
1391 configs = [ "//build/config/nacl:irt_optimize" ] | 1393 configs = [ "//build/config/nacl:irt_optimize" ] |
1392 } else { | 1394 } else { |
1393 ldflags = common_optimize_on_ldflags | 1395 ldflags = common_optimize_on_ldflags |
1394 if (is_win) { | 1396 if (is_win) { |
1395 # Favor speed over size, /O2 must be before the common flags. The GYP | 1397 # Favor speed over size, /O2 must be before the common flags. The GYP |
1396 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2. | 1398 # build also specifies /Ot, /Oi, and /GF, but these are implied by /O2. |
1397 cflags = [ "/O2" ] + common_optimize_on_cflags | 1399 cflags = [ "/O2" ] + common_optimize_on_cflags |
1398 | 1400 |
1399 # TODO(thakis): Remove is_clang here, https://crbug.com/598772 | 1401 if (is_official_build) { |
1400 if (is_official_build && !is_clang) { | 1402 if (!is_clang) { |
1401 cflags += [ | 1403 cflags += [ |
1402 "/GL", # Whole program optimization. | 1404 "/GL", # Whole program optimization. |
1403 | 1405 |
1404 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. | 1406 # Disable Warning 4702 ("Unreachable code") for the WPO/PGO builds. |
1405 # Probably anything that this would catch that wouldn't be caught in a | 1407 # Probably anything that this would catch that wouldn't be caught |
1406 # normal build isn't going to actually be a bug, so the incremental | 1408 # in a normal build isn't going to actually be a bug, so the |
1407 # value of C4702 for PGO builds is likely very small. | 1409 # incremental value of C4702 for PGO builds is likely very small. |
1408 "/wd4702", | 1410 "/wd4702", |
1409 ] | 1411 ] |
| 1412 } else if (is_clang && use_lld) { |
| 1413 cflags += [ "-flto" ] # Link-time optimization (whole program optimiz
ation). |
| 1414 } |
1410 } | 1415 } |
1411 } else if (optimize_for_fuzzing) { | 1416 } else if (optimize_for_fuzzing) { |
1412 cflags = [ "-O1" ] + common_optimize_on_cflags | 1417 cflags = [ "-O1" ] + common_optimize_on_cflags |
1413 } else { | 1418 } else { |
1414 cflags = [ "-O2" ] + common_optimize_on_cflags | 1419 cflags = [ "-O2" ] + common_optimize_on_cflags |
1415 } | 1420 } |
1416 } | 1421 } |
1417 } | 1422 } |
1418 | 1423 |
1419 # This config can be used to override the default settings for per-component | 1424 # This config can be used to override the default settings for per-component |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 | 1612 |
1608 if (is_ios || is_mac) { | 1613 if (is_ios || is_mac) { |
1609 # On Mac and iOS, this enables support for ARC (automatic ref-counting). | 1614 # On Mac and iOS, this enables support for ARC (automatic ref-counting). |
1610 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. | 1615 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. |
1611 config("enable_arc") { | 1616 config("enable_arc") { |
1612 common_flags = [ "-fobjc-arc" ] | 1617 common_flags = [ "-fobjc-arc" ] |
1613 cflags_objc = common_flags | 1618 cflags_objc = common_flags |
1614 cflags_objcc = common_flags | 1619 cflags_objcc = common_flags |
1615 } | 1620 } |
1616 } | 1621 } |
OLD | NEW |