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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 # Enable -fsanitize-coverage. | 133 # Enable -fsanitize-coverage. |
134 use_sanitizer_coverage = | 134 use_sanitizer_coverage = |
135 use_libfuzzer || use_afl || sanitizer_coverage_flags != "" | 135 use_libfuzzer || use_afl || sanitizer_coverage_flags != "" |
136 | 136 |
137 # Detect overflow/underflow for global objects. | 137 # Detect overflow/underflow for global objects. |
138 # | 138 # |
139 # Mac: http://crbug.com/352073 | 139 # Mac: http://crbug.com/352073 |
140 asan_globals = !is_mac | 140 asan_globals = !is_mac |
141 } | 141 } |
142 | 142 |
143 if (use_afl && sanitizer_coverage_flags == "") { | 143 if ((use_afl || use_libfuzzer) && sanitizer_coverage_flags == "") { |
144 sanitizer_coverage_flags = "trace-pc-guard" | 144 sanitizer_coverage_flags = "trace-pc-guard" |
145 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { | 145 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { |
146 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" | 146 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" |
147 } | 147 } |
148 | 148 |
149 using_sanitizer = | 149 using_sanitizer = |
150 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || | 150 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || |
151 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage | 151 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage |
152 | 152 |
153 assert(!using_sanitizer || is_clang, | 153 assert(!using_sanitizer || is_clang, |
(...skipping 29 matching lines...) Expand all Loading... |
183 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 183 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), |
184 "Sanitizers should generally be used in release (set is_debug=false).") | 184 "Sanitizers should generally be used in release (set is_debug=false).") |
185 | 185 |
186 assert(!is_msan || (is_linux && current_cpu == "x64"), | 186 assert(!is_msan || (is_linux && current_cpu == "x64"), |
187 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 187 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
188 | 188 |
189 # ASAN build on Windows is not working in debug mode. Intercepting memory | 189 # ASAN build on Windows is not working in debug mode. Intercepting memory |
190 # allocation functions is hard on Windows and not yet implemented in LLVM. | 190 # allocation functions is hard on Windows and not yet implemented in LLVM. |
191 assert(!is_win || !is_debug || !is_asan, | 191 assert(!is_win || !is_debug || !is_asan, |
192 "ASan on Windows doesn't work in debug (set is_debug=false).") | 192 "ASan on Windows doesn't work in debug (set is_debug=false).") |
OLD | NEW |