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") | |
6 | |
7 declare_args() { | 5 declare_args() { |
8 # Compile for Address Sanitizer to find memory bugs. | 6 # Compile for Address Sanitizer to find memory bugs. |
9 is_asan = false | 7 is_asan = false |
10 | 8 |
11 # Compile for Leak Sanitizer to find leaks. | 9 # Compile for Leak Sanitizer to find leaks. |
12 is_lsan = false | 10 is_lsan = false |
13 | 11 |
14 # Compile for Memory Sanitizer to find uninitialized reads. | 12 # Compile for Memory Sanitizer to find uninitialized reads. |
15 is_msan = false | 13 is_msan = false |
16 | 14 |
(...skipping 15 matching lines...) Expand all Loading... |
32 # Use dynamic libraries instrumented by one of the sanitizers instead of the | 30 # Use dynamic libraries instrumented by one of the sanitizers instead of the |
33 # standard system libraries. Set this flag to download prebuilt binaries from | 31 # standard system libraries. Set this flag to download prebuilt binaries from |
34 # GCS. | 32 # GCS. |
35 use_prebuilt_instrumented_libraries = false | 33 use_prebuilt_instrumented_libraries = false |
36 | 34 |
37 # Enable building with SyzyAsan which can find certain types of memory | 35 # Enable building with SyzyAsan which can find certain types of memory |
38 # errors. Only works on Windows. See | 36 # errors. Only works on Windows. See |
39 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo | 37 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo |
40 is_syzyasan = false | 38 is_syzyasan = false |
41 | 39 |
| 40 # Compile with Control Flow Integrity to protect virtual calls and casts. |
| 41 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html |
| 42 is_cfi = false |
| 43 |
42 # By default, Control Flow Integrity will crash the program if it detects a | 44 # By default, Control Flow Integrity will crash the program if it detects a |
43 # violation. Set this to true to print detailed diagnostics instead. | 45 # violation. Set this to true to print detailed diagnostics instead. |
44 use_cfi_diag = false | 46 use_cfi_diag = false |
45 | 47 |
46 # Compile for fuzzing with LLVM LibFuzzer. | 48 # Compile for fuzzing with LLVM LibFuzzer. |
47 # See http://www.chromium.org/developers/testing/libfuzzer | 49 # See http://www.chromium.org/developers/testing/libfuzzer |
48 use_libfuzzer = false | 50 use_libfuzzer = false |
49 | 51 |
50 # Compile for fuzzing with Dr. Fuzz | 52 # Compile for fuzzing with Dr. Fuzz |
51 # See http://www.chromium.org/developers/testing/dr-fuzz | 53 # See http://www.chromium.org/developers/testing/dr-fuzz |
52 use_drfuzz = false | 54 use_drfuzz = false |
53 } | 55 } |
54 | 56 |
55 # Args that are in turn dependent on other args must be in a separate | 57 # Args that are in turn dependent on other args must be in a separate |
56 # declare_args block. User overrides are only applied at the end of a | 58 # declare_args block. User overrides are only applied at the end of a |
57 # declare_args block. | 59 # declare_args block. |
58 declare_args() { | 60 declare_args() { |
59 # Compile with Control Flow Integrity to protect virtual calls and casts. | |
60 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html | |
61 is_cfi = is_linux && !is_chromeos && target_cpu == "x64" && | |
62 is_chrome_branded && is_official_build | |
63 | |
64 # Use libc++ (buildtools/third_party/libc++ and | 61 # Use libc++ (buildtools/third_party/libc++ and |
65 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. | 62 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. |
66 # This is intended to be used for instrumented builds. | 63 # This is intended to be used for instrumented builds. |
67 use_custom_libcxx = | 64 use_custom_libcxx = |
68 (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || use_libfuzzer | 65 (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || use_libfuzzer |
69 | 66 |
70 use_sanitizer_coverage = use_libfuzzer | 67 use_sanitizer_coverage = use_libfuzzer |
71 } | 68 } |
72 | 69 |
73 using_sanitizer = | 70 using_sanitizer = |
(...skipping 14 matching lines...) Expand all Loading... |
88 # without having people accidentally get broken builds by compiling an | 85 # without having people accidentally get broken builds by compiling an |
89 # unsupported or unadvisable configurations. | 86 # unsupported or unadvisable configurations. |
90 # | 87 # |
91 # For one-off testing, just comment this assertion out. | 88 # For one-off testing, just comment this assertion out. |
92 assert( | 89 assert( |
93 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), | 90 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), |
94 "Sanitizers should generally be used in release (set is_debug=false).") | 91 "Sanitizers should generally be used in release (set is_debug=false).") |
95 | 92 |
96 assert(!(is_android && is_asan && !is_component_build), | 93 assert(!(is_android && is_asan && !is_component_build), |
97 "is_asan on Android requires is_component_build to be set") | 94 "is_asan on Android requires is_component_build to be set") |
OLD | NEW |