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 | 52 |
51 # Args that are in turn dependent on other args must be in a separate | 53 # Args that are in turn dependent on other args must be in a separate |
52 # declare_args block. User overrides are only applied at the end of a | 54 # declare_args block. User overrides are only applied at the end of a |
53 # declare_args block. | 55 # declare_args block. |
54 declare_args() { | 56 declare_args() { |
55 # Compile with Control Flow Integrity to protect virtual calls and casts. | |
56 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html | |
57 is_cfi = is_linux && !is_chromeos && target_cpu == "x64" && | |
58 is_chrome_branded && is_official_build | |
59 | |
60 # Use libc++ (buildtools/third_party/libc++ and | 57 # Use libc++ (buildtools/third_party/libc++ and |
61 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. | 58 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. |
62 # This is intended to be used for instrumented builds. | 59 # This is intended to be used for instrumented builds. |
63 use_custom_libcxx = | 60 use_custom_libcxx = |
64 (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || use_libfuzzer | 61 (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || use_libfuzzer |
65 | 62 |
66 use_sanitizer_coverage = use_libfuzzer | 63 use_sanitizer_coverage = use_libfuzzer |
67 } | 64 } |
68 | 65 |
69 using_sanitizer = | 66 using_sanitizer = |
(...skipping 14 matching lines...) Expand all Loading... |
84 # without having people accidentally get broken builds by compiling an | 81 # without having people accidentally get broken builds by compiling an |
85 # unsupported or unadvisable configurations. | 82 # unsupported or unadvisable configurations. |
86 # | 83 # |
87 # For one-off testing, just comment this assertion out. | 84 # For one-off testing, just comment this assertion out. |
88 assert( | 85 assert( |
89 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), | 86 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr), |
90 "Sanitizers should generally be used in release (set is_debug=false).") | 87 "Sanitizers should generally be used in release (set is_debug=false).") |
91 | 88 |
92 assert(!(is_android && is_asan && !is_component_build), | 89 assert(!(is_android && is_asan && !is_component_build), |
93 "is_asan on Android requires is_component_build to be set") | 90 "is_asan on Android requires is_component_build to be set") |
OLD | NEW |