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 | 7 |
7 declare_args() { | 8 declare_args() { |
8 # Compile for Address Sanitizer to find memory bugs. | 9 # Compile for Address Sanitizer to find memory bugs. |
9 is_asan = false | 10 is_asan = false |
10 | 11 |
11 # Compile for Leak Sanitizer to find leaks. | 12 # Compile for Leak Sanitizer to find leaks. |
12 is_lsan = false | 13 is_lsan = false |
13 | 14 |
14 # Compile for Memory Sanitizer to find uninitialized reads. | 15 # Compile for Memory Sanitizer to find uninitialized reads. |
15 is_msan = false | 16 is_msan = false |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 # Enable building with SyzyAsan which can find certain types of memory | 48 # Enable building with SyzyAsan which can find certain types of memory |
48 # errors. Only works on Windows. See | 49 # errors. Only works on Windows. See |
49 # https://github.com/google/syzygy/wiki/SyzyASanHowTo | 50 # https://github.com/google/syzygy/wiki/SyzyASanHowTo |
50 is_syzyasan = false | 51 is_syzyasan = false |
51 | 52 |
52 # Compile with Control Flow Integrity to protect virtual calls and casts. | 53 # Compile with Control Flow Integrity to protect virtual calls and casts. |
53 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html | 54 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html |
54 # | 55 # |
55 # TODO(pcc): Remove this flag if/when CFI is enabled in all official builds. | 56 # TODO(pcc): Remove this flag if/when CFI is enabled in all official builds. |
56 is_cfi = target_os == "linux" && !is_chromeos && target_cpu == "x64" && | 57 is_cfi = target_os == "linux" && !is_chromeos && target_cpu == "x64" && |
57 is_chrome_branded && is_official_build | 58 is_chrome_branded && is_official_build && allow_posix_link_time_opt |
58 | 59 |
59 # Enable checks for bad casts: derived cast and unrelated cast. | 60 # Enable checks for bad casts: derived cast and unrelated cast. |
60 # TODO(krasin): remove this, when we're ready to add these checks by default. | 61 # TODO(krasin): remove this, when we're ready to add these checks by default. |
61 # https://crbug.com/626794 | 62 # https://crbug.com/626794 |
62 use_cfi_cast = false | 63 use_cfi_cast = false |
63 | 64 |
64 # By default, Control Flow Integrity will crash the program if it detects a | 65 # By default, Control Flow Integrity will crash the program if it detects a |
65 # violation. Set this to true to print detailed diagnostics instead. | 66 # violation. Set this to true to print detailed diagnostics instead. |
66 use_cfi_diag = false | 67 use_cfi_diag = false |
67 | 68 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 # this condition. We may also be able to find another way to enable your case | 166 # this condition. We may also be able to find another way to enable your case |
166 # without having people accidentally get broken builds by compiling an | 167 # without having people accidentally get broken builds by compiling an |
167 # unsupported or unadvisable configurations. | 168 # unsupported or unadvisable configurations. |
168 # | 169 # |
169 # For one-off testing, just comment this assertion out. | 170 # For one-off testing, just comment this assertion out. |
170 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), | 171 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), |
171 "Sanitizers should generally be used in release (set is_debug=false).") | 172 "Sanitizers should generally be used in release (set is_debug=false).") |
172 | 173 |
173 assert(!is_msan || (is_linux && current_cpu == "x64"), | 174 assert(!is_msan || (is_linux && current_cpu == "x64"), |
174 "MSan currently only works on 64-bit Linux and ChromeOS builds.") | 175 "MSan currently only works on 64-bit Linux and ChromeOS builds.") |
OLD | NEW |