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 | 6 |
7 declare_args() { | 7 declare_args() { |
8 # Compile for Address Sanitizer to find memory bugs. | 8 # Compile for Address Sanitizer to find memory bugs. |
9 is_asan = false | 9 is_asan = false |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 # Mac: http://crbug.com/352073 | 142 # Mac: http://crbug.com/352073 |
143 asan_globals = !is_android && !is_mac | 143 asan_globals = !is_android && !is_mac |
144 } | 144 } |
145 | 145 |
146 if (use_afl && sanitizer_coverage_flags == "") { | 146 if (use_afl && sanitizer_coverage_flags == "") { |
147 sanitizer_coverage_flags = "trace-pc" | 147 sanitizer_coverage_flags = "trace-pc" |
148 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { | 148 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { |
149 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" | 149 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" |
150 } | 150 } |
151 | 151 |
152 using_sanitizer = | 152 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan || |
153 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || | 153 is_ubsan_null || is_ubsan_vptr || is_ubsan_security || |
154 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage | 154 use_afl || use_libfuzzer || use_sanitizer_coverage |
Nico
2016/09/02 18:25:00
Why this change? afl and libfuzzer don't mean usin
| |
155 | 155 |
156 assert(!using_sanitizer || is_clang, | 156 assert(!using_sanitizer || is_clang, |
157 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") | 157 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
158 | 158 |
159 prebuilt_instrumented_libraries_available = | 159 prebuilt_instrumented_libraries_available = |
160 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) | 160 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) |
161 | 161 |
162 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 162 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
163 # same is possibly true for the other non-ASan sanitizers. But regardless of | 163 # same is possibly true for the other non-ASan sanitizers. But regardless of |
164 # whether it links, one would normally never run a sanitizer in debug mode. | 164 # whether it links, one would normally never run a sanitizer in debug mode. |
165 # Running in debug mode probably indicates you forgot to set the "is_debug = | 165 # Running in debug mode probably indicates you forgot to set the "is_debug = |
166 # false" flag in the build args. ASan seems to run fine in debug mode. | 166 # false" flag in the build args. ASan seems to run fine in debug mode. |
167 # | 167 # |
168 # If you find a use-case where you want to compile a sanitizer in debug mode | 168 # If you find a use-case where you want to compile a sanitizer in debug mode |
169 # and have verified it works, ask brettw and we can consider removing it from | 169 # and have verified it works, ask brettw and we can consider removing it from |
170 # this condition. We may also be able to find another way to enable your case | 170 # this condition. We may also be able to find another way to enable your case |
171 # without having people accidentally get broken builds by compiling an | 171 # without having people accidentally get broken builds by compiling an |
172 # unsupported or unadvisable configurations. | 172 # unsupported or unadvisable configurations. |
173 # | 173 # |
174 # For one-off testing, just comment this assertion out. | 174 # For one-off testing, just comment this assertion out. |
175 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 175 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), |
176 "Sanitizers should generally be used in release (set is_debug=false).") | 176 "Sanitizers should generally be used in release (set is_debug=false).") |
177 | 177 |
178 assert(!is_msan || (is_linux && current_cpu == "x64"), | 178 assert(!is_msan || (is_linux && current_cpu == "x64"), |
179 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 179 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
OLD | NEW |