| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 # Args that are in turn dependent on other args must be in a separate | 65 # Args that are in turn dependent on other args must be in a separate |
| 66 # declare_args block. User overrides are only applied at the end of a | 66 # declare_args block. User overrides are only applied at the end of a |
| 67 # declare_args block. | 67 # declare_args block. |
| 68 declare_args() { | 68 declare_args() { |
| 69 # Use libc++ (buildtools/third_party/libc++ and | 69 # Use libc++ (buildtools/third_party/libc++ and |
| 70 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. | 70 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. |
| 71 # This is intended to be used for instrumented builds. | 71 # This is intended to be used for instrumented builds. |
| 72 use_custom_libcxx = (is_asan && (is_linux || is_mac)) || is_tsan || is_msan || | 72 use_custom_libcxx = (is_asan && (is_linux || is_mac)) || is_tsan || is_msan || |
| 73 is_ubsan || use_libfuzzer | 73 is_ubsan || is_ubsan_security || use_libfuzzer |
| 74 | 74 |
| 75 # Enable Link Time Optimization (output programs runs faster, | 75 # Enable Link Time Optimization (output programs runs faster, |
| 76 # but linking is up to 5-20x slower. | 76 # but linking is up to 5-20x slower. |
| 77 is_lto = is_cfi | 77 is_lto = is_cfi |
| 78 | 78 |
| 79 use_sanitizer_coverage = use_libfuzzer | 79 use_sanitizer_coverage = use_libfuzzer |
| 80 } | 80 } |
| 81 | 81 |
| 82 using_sanitizer = | 82 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan || |
| 83 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_vptr | 83 is_ubsan_vptr || is_ubsan_security |
| 84 | 84 |
| 85 assert(!using_sanitizer || is_clang, | 85 assert(!using_sanitizer || is_clang, |
| 86 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") | 86 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") |
| 87 | 87 |
| 88 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The | 88 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The |
| 89 # same is possibly true for the other non-ASan sanitizers. But regardless of | 89 # same is possibly true for the other non-ASan sanitizers. But regardless of |
| 90 # whether it links, one would normally never run a sanitizer in debug mode. | 90 # whether it links, one would normally never run a sanitizer in debug mode. |
| 91 # Running in debug mode probably indicates you forgot to set the "is_debug = | 91 # Running in debug mode probably indicates you forgot to set the "is_debug = |
| 92 # false" flag in the build args. ASan seems to run fine in debug mode. | 92 # false" flag in the build args. ASan seems to run fine in debug mode. |
| 93 # | 93 # |
| 94 # If you find a use-case where you want to compile a sanitizer in debug mode | 94 # If you find a use-case where you want to compile a sanitizer in debug mode |
| 95 # and have verified it works, ask brettw and we can consider removing it from | 95 # and have verified it works, ask brettw and we can consider removing it from |
| 96 # this condition. We may also be able to find another way to enable your case | 96 # this condition. We may also be able to find another way to enable your case |
| 97 # without having people accidentally get broken builds by compiling an | 97 # without having people accidentally get broken builds by compiling an |
| 98 # unsupported or unadvisable configurations. | 98 # unsupported or unadvisable configurations. |
| 99 # | 99 # |
| 100 # For one-off testing, just comment this assertion out. | 100 # For one-off testing, just comment this assertion out. |
| 101 assert( | 101 assert( |
| 102 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), | 102 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), |
| 103 "Sanitizers should generally be used in release (set is_debug=false).") | 103 "Sanitizers should generally be used in release (set is_debug=false).") |
| OLD | NEW |