| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 # Compile for fuzzing with Dr. Fuzz | 85 # Compile for fuzzing with Dr. Fuzz |
| 86 # See http://www.chromium.org/developers/testing/dr-fuzz | 86 # See http://www.chromium.org/developers/testing/dr-fuzz |
| 87 use_drfuzz = false | 87 use_drfuzz = false |
| 88 | 88 |
| 89 # Helper variable for testing builds with disabled libfuzzer. | 89 # Helper variable for testing builds with disabled libfuzzer. |
| 90 # Not for client use. | 90 # Not for client use. |
| 91 disable_libfuzzer = false | 91 disable_libfuzzer = false |
| 92 | 92 |
| 93 # Value for -fsanitize-coverage flag. Setting this causes | 93 # Value for -fsanitize-coverage flag. Setting this causes |
| 94 # use_sanitizer_coverage to be enabled. | 94 # use_sanitizer_coverage to be enabled. |
| 95 # Default value when unset and use_afl=true: | 95 # Default value when unset and use_afl=true or use_libfuzzer=true: |
| 96 # trace-pc | 96 # trace-pc-guard |
| 97 # Default value when unset and use_sanitizer_coverage=true: | 97 # Default value when unset and use_sanitizer_coverage=true: |
| 98 # edge,indirect-calls,8bit-counters | 98 # trace-pc-guard,indirect-calls |
| 99 sanitizer_coverage_flags = "" | 99 sanitizer_coverage_flags = "" |
| 100 | 100 |
| 101 # Keep symbol level when building with sanitizers. When sanitizers are | 101 # Keep symbol level when building with sanitizers. When sanitizers are |
| 102 # enabled, the default is to compile with the minimum debug info level | 102 # enabled, the default is to compile with the minimum debug info level |
| 103 # necessary, overriding any other symbol level arguments that may be set. | 103 # necessary, overriding any other symbol level arguments that may be set. |
| 104 # Setting this to true prevents this. | 104 # Setting this to true prevents this. |
| 105 sanitizer_keep_symbols = false | 105 sanitizer_keep_symbols = false |
| 106 } | 106 } |
| 107 | 107 |
| 108 # Disable sanitizers for non-default toolchains. | 108 # Disable sanitizers for non-default toolchains. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 147 |
| 148 # Detect overflow/underflow for global objects. | 148 # Detect overflow/underflow for global objects. |
| 149 # | 149 # |
| 150 # Mac: http://crbug.com/352073 | 150 # Mac: http://crbug.com/352073 |
| 151 asan_globals = !is_mac | 151 asan_globals = !is_mac |
| 152 } | 152 } |
| 153 | 153 |
| 154 if ((use_afl || use_libfuzzer) && sanitizer_coverage_flags == "") { | 154 if ((use_afl || use_libfuzzer) && sanitizer_coverage_flags == "") { |
| 155 sanitizer_coverage_flags = "trace-pc-guard" | 155 sanitizer_coverage_flags = "trace-pc-guard" |
| 156 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { | 156 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { |
| 157 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" | 157 sanitizer_coverage_flags = "trace-pc-guard,indirect-calls" |
| 158 } | 158 } |
| 159 | 159 |
| 160 using_sanitizer = | 160 using_sanitizer = |
| 161 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || | 161 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_null || |
| 162 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage | 162 is_ubsan_vptr || is_ubsan_security || use_sanitizer_coverage |
| 163 | 163 |
| 164 assert(!using_sanitizer || is_clang, | 164 assert(!using_sanitizer || is_clang, |
| 165 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") | 165 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
| 166 | 166 |
| 167 prebuilt_instrumented_libraries_available = | 167 prebuilt_instrumented_libraries_available = |
| (...skipping 26 matching lines...) Expand all Loading... |
| 194 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 194 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), |
| 195 "Sanitizers should generally be used in release (set is_debug=false).") | 195 "Sanitizers should generally be used in release (set is_debug=false).") |
| 196 | 196 |
| 197 assert(!is_msan || (is_linux && current_cpu == "x64"), | 197 assert(!is_msan || (is_linux && current_cpu == "x64"), |
| 198 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 198 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
| 199 | 199 |
| 200 # ASAN build on Windows is not working in debug mode. Intercepting memory | 200 # ASAN build on Windows is not working in debug mode. Intercepting memory |
| 201 # allocation functions is hard on Windows and not yet implemented in LLVM. | 201 # allocation functions is hard on Windows and not yet implemented in LLVM. |
| 202 assert(!is_win || !is_debug || !is_asan, | 202 assert(!is_win || !is_debug || !is_asan, |
| 203 "ASan on Windows doesn't work in debug (set is_debug=false).") | 203 "ASan on Windows doesn't work in debug (set is_debug=false).") |
| OLD | NEW |