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 import("//build/config/chrome_build.gni") | 5 import("//build/config/chrome_build.gni") |
6 import("//build/toolchain/toolchain.gni") | 6 import("//build/toolchain/toolchain.gni") |
7 | 7 |
8 declare_args() { | 8 declare_args() { |
9 # Compile for Address Sanitizer to find memory bugs. | 9 # Compile for Address Sanitizer to find memory bugs. |
10 is_asan = false | 10 is_asan = false |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 using_sanitizer = | 148 using_sanitizer = |
149 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || | 149 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || |
150 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage | 150 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage |
151 | 151 |
152 assert(!using_sanitizer || is_clang, | 152 assert(!using_sanitizer || is_clang, |
153 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") | 153 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
154 | 154 |
155 prebuilt_instrumented_libraries_available = | 155 prebuilt_instrumented_libraries_available = |
156 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) | 156 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) |
157 | 157 |
| 158 if (use_libfuzzer && is_asan && is_linux) { |
| 159 # We do leak checking with libFuzzer on Linux. Set is_lsan for code that |
| 160 # relies on LEAK_SANITIZER define to avoid false positives. |
| 161 is_lsan = true |
| 162 } |
| 163 |
158 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 164 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
159 # same is possibly true for the other non-ASan sanitizers. But regardless of | 165 # same is possibly true for the other non-ASan sanitizers. But regardless of |
160 # whether it links, one would normally never run a sanitizer in debug mode. | 166 # whether it links, one would normally never run a sanitizer in debug mode. |
161 # Running in debug mode probably indicates you forgot to set the "is_debug = | 167 # Running in debug mode probably indicates you forgot to set the "is_debug = |
162 # false" flag in the build args. ASan seems to run fine in debug mode. | 168 # false" flag in the build args. ASan seems to run fine in debug mode. |
163 # | 169 # |
164 # If you find a use-case where you want to compile a sanitizer in debug mode | 170 # If you find a use-case where you want to compile a sanitizer in debug mode |
165 # and have verified it works, ask brettw and we can consider removing it from | 171 # and have verified it works, ask brettw and we can consider removing it from |
166 # this condition. We may also be able to find another way to enable your case | 172 # this condition. We may also be able to find another way to enable your case |
167 # without having people accidentally get broken builds by compiling an | 173 # without having people accidentally get broken builds by compiling an |
168 # unsupported or unadvisable configurations. | 174 # unsupported or unadvisable configurations. |
169 # | 175 # |
170 # For one-off testing, just comment this assertion out. | 176 # For one-off testing, just comment this assertion out. |
171 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 177 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), |
172 "Sanitizers should generally be used in release (set is_debug=false).") | 178 "Sanitizers should generally be used in release (set is_debug=false).") |
173 | 179 |
174 assert(!is_msan || (is_linux && current_cpu == "x64"), | 180 assert(!is_msan || (is_linux && current_cpu == "x64"), |
175 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 181 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
OLD | NEW |