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