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 declare_args() { | 5 declare_args() { |
6 # Compile for Address Sanitizer to find memory bugs. | 6 # Compile for Address Sanitizer to find memory bugs. |
7 is_asan = false | 7 is_asan = false |
8 | 8 |
9 # Compile for Leak Sanitizer to find leaks. | 9 # Compile for Leak Sanitizer to find leaks. |
10 is_lsan = false | 10 is_lsan = false |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 # Mac: http://crbug.com/352073 | 115 # Mac: http://crbug.com/352073 |
116 asan_globals = !is_android && !is_mac | 116 asan_globals = !is_android && !is_mac |
117 } | 117 } |
118 | 118 |
119 if (use_afl && sanitizer_coverage_flags == "") { | 119 if (use_afl && sanitizer_coverage_flags == "") { |
120 sanitizer_coverage_flags = "trace-pc" | 120 sanitizer_coverage_flags = "trace-pc" |
121 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { | 121 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { |
122 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" | 122 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" |
123 } | 123 } |
124 | 124 |
125 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan || | 125 using_sanitizer = |
126 is_ubsan_null || is_ubsan_vptr || is_ubsan_security | 126 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || |
| 127 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage |
127 | 128 |
128 assert(!using_sanitizer || is_clang, | 129 assert(!using_sanitizer || is_clang, |
129 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") | 130 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
130 | 131 |
131 prebuilt_instrumented_libraries_available = | 132 prebuilt_instrumented_libraries_available = |
132 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) | 133 is_msan && (msan_track_origins == 0 || msan_track_origins == 2) |
133 | 134 |
134 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 135 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
135 # same is possibly true for the other non-ASan sanitizers. But regardless of | 136 # same is possibly true for the other non-ASan sanitizers. But regardless of |
136 # whether it links, one would normally never run a sanitizer in debug mode. | 137 # whether it links, one would normally never run a sanitizer in debug mode. |
137 # Running in debug mode probably indicates you forgot to set the "is_debug = | 138 # Running in debug mode probably indicates you forgot to set the "is_debug = |
138 # false" flag in the build args. ASan seems to run fine in debug mode. | 139 # false" flag in the build args. ASan seems to run fine in debug mode. |
139 # | 140 # |
140 # If you find a use-case where you want to compile a sanitizer in debug mode | 141 # If you find a use-case where you want to compile a sanitizer in debug mode |
141 # and have verified it works, ask brettw and we can consider removing it from | 142 # and have verified it works, ask brettw and we can consider removing it from |
142 # this condition. We may also be able to find another way to enable your case | 143 # this condition. We may also be able to find another way to enable your case |
143 # without having people accidentally get broken builds by compiling an | 144 # without having people accidentally get broken builds by compiling an |
144 # unsupported or unadvisable configurations. | 145 # unsupported or unadvisable configurations. |
145 # | 146 # |
146 # For one-off testing, just comment this assertion out. | 147 # For one-off testing, just comment this assertion out. |
147 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 148 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), |
148 "Sanitizers should generally be used in release (set is_debug=false).") | 149 "Sanitizers should generally be used in release (set is_debug=false).") |
149 | 150 |
150 assert(!is_msan || (is_linux && current_cpu == "x64"), | 151 assert(!is_msan || (is_linux && current_cpu == "x64"), |
151 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 152 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
OLD | NEW |