OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 declare_args() { | 5 declare_args() { |
6 # Compile for Address Sanitizer to find memory bugs. | 6 # Compile for Address Sanitizer to find memory bugs. |
7 is_asan = false | 7 is_asan = false |
8 | 8 |
9 # Compile for Leak Sanitizer to find leaks. | 9 # Compile for Leak Sanitizer to find leaks. |
10 is_lsan = false | 10 is_lsan = false |
(...skipping 21 matching lines...) Expand all Loading... |
32 # GCS. | 32 # GCS. |
33 use_prebuilt_instrumented_libraries = false | 33 use_prebuilt_instrumented_libraries = false |
34 | 34 |
35 # Enable building with SyzyAsan which can find certain types of memory | 35 # Enable building with SyzyAsan which can find certain types of memory |
36 # errors. Only works on Windows. See | 36 # errors. Only works on Windows. See |
37 # https://github.com/google/syzygy/wiki/SyzyASanHowTo | 37 # https://github.com/google/syzygy/wiki/SyzyASanHowTo |
38 is_syzyasan = false | 38 is_syzyasan = false |
39 | 39 |
40 # Compile with Control Flow Integrity to protect virtual calls and casts. | 40 # Compile with Control Flow Integrity to protect virtual calls and casts. |
41 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html | 41 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html |
| 42 # |
| 43 # TODO(pcc): Remove this flag if/when CFI is enabled in official builds. |
42 is_cfi = false | 44 is_cfi = false |
43 | 45 |
44 # By default, Control Flow Integrity will crash the program if it detects a | 46 # By default, Control Flow Integrity will crash the program if it detects a |
45 # violation. Set this to true to print detailed diagnostics instead. | 47 # violation. Set this to true to print detailed diagnostics instead. |
46 use_cfi_diag = false | 48 use_cfi_diag = false |
47 | 49 |
48 # Compile for fuzzing with LLVM LibFuzzer. | 50 # Compile for fuzzing with LLVM LibFuzzer. |
49 # See http://www.chromium.org/developers/testing/libfuzzer | 51 # See http://www.chromium.org/developers/testing/libfuzzer |
50 use_libfuzzer = false | 52 use_libfuzzer = false |
51 | 53 |
(...skipping 13 matching lines...) Expand all Loading... |
65 # Args that are in turn dependent on other args must be in a separate | 67 # Args that are in turn dependent on other args must be in a separate |
66 # declare_args block. User overrides are only applied at the end of a | 68 # declare_args block. User overrides are only applied at the end of a |
67 # declare_args block. | 69 # declare_args block. |
68 declare_args() { | 70 declare_args() { |
69 # Use libc++ (buildtools/third_party/libc++ and | 71 # Use libc++ (buildtools/third_party/libc++ and |
70 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. | 72 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. |
71 # This is intended to be used for instrumented builds. | 73 # This is intended to be used for instrumented builds. |
72 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || | 74 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || |
73 is_ubsan_security || use_libfuzzer | 75 is_ubsan_security || use_libfuzzer |
74 | 76 |
75 # Enable Link Time Optimization (output programs runs faster, | |
76 # but linking is up to 5-20x slower. | |
77 is_lto = is_cfi | |
78 | |
79 use_sanitizer_coverage = use_libfuzzer | 77 use_sanitizer_coverage = use_libfuzzer |
80 } | 78 } |
81 | 79 |
82 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan || | 80 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan || |
83 is_ubsan_vptr || is_ubsan_security | 81 is_ubsan_vptr || is_ubsan_security |
84 | 82 |
85 assert(!using_sanitizer || is_clang, | 83 assert(!using_sanitizer || is_clang, |
86 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") | 84 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
87 | 85 |
88 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 86 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
89 # same is possibly true for the other non-ASan sanitizers. But regardless of | 87 # same is possibly true for the other non-ASan sanitizers. But regardless of |
90 # whether it links, one would normally never run a sanitizer in debug mode. | 88 # whether it links, one would normally never run a sanitizer in debug mode. |
91 # Running in debug mode probably indicates you forgot to set the "is_debug = | 89 # Running in debug mode probably indicates you forgot to set the "is_debug = |
92 # false" flag in the build args. ASan seems to run fine in debug mode. | 90 # false" flag in the build args. ASan seems to run fine in debug mode. |
93 # | 91 # |
94 # If you find a use-case where you want to compile a sanitizer in debug mode | 92 # If you find a use-case where you want to compile a sanitizer in debug mode |
95 # and have verified it works, ask brettw and we can consider removing it from | 93 # and have verified it works, ask brettw and we can consider removing it from |
96 # this condition. We may also be able to find another way to enable your case | 94 # this condition. We may also be able to find another way to enable your case |
97 # without having people accidentally get broken builds by compiling an | 95 # without having people accidentally get broken builds by compiling an |
98 # unsupported or unadvisable configurations. | 96 # unsupported or unadvisable configurations. |
99 # | 97 # |
100 # For one-off testing, just comment this assertion out. | 98 # For one-off testing, just comment this assertion out. |
101 assert( | 99 assert( |
102 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), | 100 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), |
103 "Sanitizers should generally be used in release (set is_debug=false).") | 101 "Sanitizers should generally be used in release (set is_debug=false).") |
OLD | NEW |