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) { | 158 if (use_libfuzzer && is_linux) { |
159 # We do leak checking with libFuzzer on Linux. Set is_lsan for code that | 159 if (is_asan) { |
160 # relies on LEAK_SANITIZER define to avoid false positives. | 160 # We do leak checking with libFuzzer on Linux. Set is_lsan for code that |
161 is_lsan = true | 161 # relies on LEAK_SANITIZER define to avoid false positives. |
| 162 is_lsan = true |
| 163 } |
| 164 if (is_msan) { |
| 165 use_prebuilt_instrumented_libraries = true |
| 166 } |
162 } | 167 } |
163 | 168 |
164 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 169 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
165 # same is possibly true for the other non-ASan sanitizers. But regardless of | 170 # same is possibly true for the other non-ASan sanitizers. But regardless of |
166 # whether it links, one would normally never run a sanitizer in debug mode. | 171 # whether it links, one would normally never run a sanitizer in debug mode. |
167 # Running in debug mode probably indicates you forgot to set the "is_debug = | 172 # Running in debug mode probably indicates you forgot to set the "is_debug = |
168 # false" flag in the build args. ASan seems to run fine in debug mode. | 173 # false" flag in the build args. ASan seems to run fine in debug mode. |
169 # | 174 # |
170 # If you find a use-case where you want to compile a sanitizer in debug mode | 175 # If you find a use-case where you want to compile a sanitizer in debug mode |
171 # and have verified it works, ask brettw and we can consider removing it from | 176 # and have verified it works, ask brettw and we can consider removing it from |
172 # this condition. We may also be able to find another way to enable your case | 177 # this condition. We may also be able to find another way to enable your case |
173 # without having people accidentally get broken builds by compiling an | 178 # without having people accidentally get broken builds by compiling an |
174 # unsupported or unadvisable configurations. | 179 # unsupported or unadvisable configurations. |
175 # | 180 # |
176 # For one-off testing, just comment this assertion out. | 181 # For one-off testing, just comment this assertion out. |
177 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 182 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), |
178 "Sanitizers should generally be used in release (set is_debug=false).") | 183 "Sanitizers should generally be used in release (set is_debug=false).") |
179 | 184 |
180 assert(!is_msan || (is_linux && current_cpu == "x64"), | 185 assert(!is_msan || (is_linux && current_cpu == "x64"), |
181 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 186 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
OLD | NEW |