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

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

Issue 2389923003: Add an optimize_for_fuzzing GN flag to build with -O1 (Closed)
Patch Set: add visibility Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 # Enable fatal linker warnings. Building Chromium with certain versions 79 # Enable fatal linker warnings. Building Chromium with certain versions
80 # of binutils can cause linker warning. 80 # of binutils can cause linker warning.
81 # See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359 81 # See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359
82 fatal_linker_warnings = true 82 fatal_linker_warnings = true
83 83
84 # AFDO (Automatic Feedback Directed Optimizer) is a form of profile-guided 84 # AFDO (Automatic Feedback Directed Optimizer) is a form of profile-guided
85 # optimization that GCC supports. It used by ChromeOS in their official 85 # optimization that GCC supports. It used by ChromeOS in their official
86 # builds. To use it, set auto_profile_path to the path to a file containing 86 # builds. To use it, set auto_profile_path to the path to a file containing
87 # the needed gcov profiling data. 87 # the needed gcov profiling data.
88 auto_profile_path = "" 88 auto_profile_path = ""
89
90 # Optimize for coverage guided fuzzing (balance between speed and number of
91 # branches)
92 optimize_for_fuzzing = false
89 } 93 }
90 94
91 if (is_clang && !is_nacl) { 95 if (is_clang && !is_nacl) {
92 update_args = [ "--print-revision" ] 96 update_args = [ "--print-revision" ]
93 if (llvm_force_head_revision) { 97 if (llvm_force_head_revision) {
94 update_args += [ "--llvm-force-head-revision" ] 98 update_args += [ "--llvm-force-head-revision" ]
95 } 99 }
96 clang_revision = 100 clang_revision =
97 exec_script("//tools/clang/scripts/update.py", update_args, "trim string") 101 exec_script("//tools/clang/scripts/update.py", update_args, "trim string")
98 } 102 }
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 # value of C4702 for PGO builds is likely very small. 1458 # value of C4702 for PGO builds is likely very small.
1455 "/wd4702", 1459 "/wd4702",
1456 ] 1460 ]
1457 } 1461 }
1458 } else { 1462 } else {
1459 cflags = [ "-O3" ] + common_optimize_on_cflags 1463 cflags = [ "-O3" ] + common_optimize_on_cflags
1460 } 1464 }
1461 } 1465 }
1462 } 1466 }
1463 1467
1468 config("optimize_fuzzing") {
1469 cflags = [ "-O1" ] + common_optimize_on_cflags
1470 ldflags = common_optimize_on_ldflags
1471 visibility = [ ":default_optimization" ]
1472 }
1473
1464 # The default optimization applied to all targets. This will be equivalent to 1474 # The default optimization applied to all targets. This will be equivalent to
1465 # either "optimize" or "no_optimize", depending on the build flags. 1475 # either "optimize" or "no_optimize", depending on the build flags.
1466 config("default_optimization") { 1476 config("default_optimization") {
1467 if (is_nacl_irt) { 1477 if (is_nacl_irt) {
1468 # The NaCl IRT is a special case and always wants its own config. 1478 # The NaCl IRT is a special case and always wants its own config.
1469 # It gets optimized the same way regardless of the type of build. 1479 # It gets optimized the same way regardless of the type of build.
1470 configs = [ "//build/config/nacl:irt_optimize" ] 1480 configs = [ "//build/config/nacl:irt_optimize" ]
1471 } else if (is_debug) { 1481 } else if (is_debug) {
1472 configs = [ ":no_optimize" ] 1482 configs = [ ":no_optimize" ]
1483 } else if (optimize_for_fuzzing) {
1484 assert(!is_win, "Fuzzing optimize level not supported on Windows")
1485 configs = [ ":optimize_fuzzing" ]
1473 } else { 1486 } else {
1474 configs = [ ":optimize" ] 1487 configs = [ ":optimize" ]
1475 } 1488 }
1476 } 1489 }
1477 1490
1478 # GCC supports a form of profile-guided optimization called AFDO, which 1491 # GCC supports a form of profile-guided optimization called AFDO, which
1479 # is used by ChromeOS in their official builds. However, 1492 # is used by ChromeOS in their official builds. However,
1480 # //base/allocator:tcmalloc currently doesn't work correctly with AFDO 1493 # //base/allocator:tcmalloc currently doesn't work correctly with AFDO
1481 # so we provide separate config so that the flag can be disabled per-target. 1494 # so we provide separate config so that the flag can be disabled per-target.
1482 # TODO(crbug.com/633719): Remove this config once tcmalloc works with AFDO 1495 # TODO(crbug.com/633719): Remove this config once tcmalloc works with AFDO
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 1611
1599 if (is_ios || is_mac) { 1612 if (is_ios || is_mac) {
1600 # On Mac and iOS, this enables support for ARC (automatic ref-counting). 1613 # On Mac and iOS, this enables support for ARC (automatic ref-counting).
1601 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html. 1614 # See http://clang.llvm.org/docs/AutomaticReferenceCounting.html.
1602 config("enable_arc") { 1615 config("enable_arc") {
1603 common_flags = [ "-fobjc-arc" ] 1616 common_flags = [ "-fobjc-arc" ]
1604 cflags_objc = common_flags 1617 cflags_objc = common_flags
1605 cflags_objcc = common_flags 1618 cflags_objcc = common_flags
1606 } 1619 }
1607 } 1620 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698