| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 use_custom_libcxx = | 127 use_custom_libcxx = |
| 128 (is_asan && is_linux && !is_chromeos) || is_tsan || is_msan || is_ubsan || | 128 (is_asan && is_linux && !is_chromeos) || is_tsan || is_msan || is_ubsan || |
| 129 is_ubsan_security || use_libfuzzer || use_afl | 129 is_ubsan_security || use_libfuzzer || use_afl |
| 130 | 130 |
| 131 # Enable -fsanitize-coverage. | 131 # Enable -fsanitize-coverage. |
| 132 use_sanitizer_coverage = | 132 use_sanitizer_coverage = |
| 133 use_libfuzzer || use_afl || sanitizer_coverage_flags != "" | 133 use_libfuzzer || use_afl || sanitizer_coverage_flags != "" |
| 134 | 134 |
| 135 # Detect overflow/underflow for global objects. | 135 # Detect overflow/underflow for global objects. |
| 136 # | 136 # |
| 137 # Android build relies on -Wl,--gc-sections removing unreachable code. | |
| 138 # ASan instrumentation for globals inhibits this and results in a | |
| 139 # library with unresolvable relocations. | |
| 140 # TODO(eugenis): find a way to reenable this. | |
| 141 # | |
| 142 # Mac: http://crbug.com/352073 | 137 # Mac: http://crbug.com/352073 |
| 143 asan_globals = !is_android && !is_mac | 138 asan_globals = !is_mac |
| 144 } | 139 } |
| 145 | 140 |
| 146 if (use_afl && sanitizer_coverage_flags == "") { | 141 if (use_afl && sanitizer_coverage_flags == "") { |
| 147 sanitizer_coverage_flags = "trace-pc" | 142 sanitizer_coverage_flags = "trace-pc" |
| 148 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { | 143 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { |
| 149 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" | 144 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" |
| 150 } | 145 } |
| 151 | 146 |
| 152 using_sanitizer = | 147 using_sanitizer = |
| 153 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || | 148 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || |
| (...skipping 16 matching lines...) Expand all Loading... |
| 170 # this condition. We may also be able to find another way to enable your case | 165 # 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 | 166 # without having people accidentally get broken builds by compiling an |
| 172 # unsupported or unadvisable configurations. | 167 # unsupported or unadvisable configurations. |
| 173 # | 168 # |
| 174 # For one-off testing, just comment this assertion out. | 169 # For one-off testing, just comment this assertion out. |
| 175 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 170 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).") | 171 "Sanitizers should generally be used in release (set is_debug=false).") |
| 177 | 172 |
| 178 assert(!is_msan || (is_linux && current_cpu == "x64"), | 173 assert(!is_msan || (is_linux && current_cpu == "x64"), |
| 179 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 174 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
| OLD | NEW |