Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: build/config/sanitizers/sanitizers.gni

Issue 1374423002: Add UBsan vtpr support to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-ubsan
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/config/sanitizers/BUILD.gn ('k') | build/toolchain/gcc_toolchain.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 11
12 # Compile for Memory Sanitizer to find uninitialized reads. 12 # Compile for Memory Sanitizer to find uninitialized reads.
13 is_msan = false 13 is_msan = false
14 14
15 # Compile for Thread Sanitizer to find threading bugs. 15 # Compile for Thread Sanitizer to find threading bugs.
16 is_tsan = false 16 is_tsan = false
17 17
18 # Compile for Undefined Behaviour Sanitizer to find various types of 18 # Compile for Undefined Behaviour Sanitizer to find various types of
19 # undefined behaviour. 19 # undefined behaviour (excludes vptr checks).
20 is_ubsan = false 20 is_ubsan = false
21 21
22 # Compile for Undefined Behaviour Sanitizer's vptr checks.
23 is_ubsan_vptr = false
24
22 # Use libc++ (buildtools/third_party/libc++ and 25 # Use libc++ (buildtools/third_party/libc++ and
23 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. 26 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
24 # This is intended to be used for instrumented builds. 27 # This is intended to be used for instrumented builds.
25 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan 28 use_custom_libcxx =
29 (is_asan && is_linux) || is_tsan || is_msan || is_ubsan || is_ubsan_vptr
26 30
27 # Track where uninitialized memory originates from. From fastest to slowest: 31 # Track where uninitialized memory originates from. From fastest to slowest:
28 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the 32 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the
29 # chain of stores leading from allocation site to use site. 33 # chain of stores leading from allocation site to use site.
30 msan_track_origins = 2 34 msan_track_origins = 2
31 35
32 # Use dynamic libraries instrumented by one of the sanitizers instead of the 36 # Use dynamic libraries instrumented by one of the sanitizers instead of the
33 # standard system libraries. Set this flag to download prebuilt binaries from 37 # standard system libraries. Set this flag to download prebuilt binaries from
34 # GCS. 38 # GCS.
35 use_prebuilt_instrumented_libraries = false 39 use_prebuilt_instrumented_libraries = false
36 40
37 # Enable building with SyzyAsan which can find certain types of memory 41 # Enable building with SyzyAsan which can find certain types of memory
38 # errors. Only works on Windows. See 42 # errors. Only works on Windows. See
39 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo 43 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo
40 is_syzyasan = false 44 is_syzyasan = false
41 45
42 # Compile with Control Flow Integrity to protect virtual calls and casts. 46 # Compile with Control Flow Integrity to protect virtual calls and casts.
43 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html 47 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html
44 is_cfi = false 48 is_cfi = false
45 49
46 # By default, Control Flow Integrity will crash the program if it detects a 50 # By default, Control Flow Integrity will crash the program if it detects a
47 # violation. Set this to true to print detailed diagnostics instead. 51 # violation. Set this to true to print detailed diagnostics instead.
48 use_cfi_diag = false 52 use_cfi_diag = false
49 } 53 }
50 54
51 # TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr 55 # TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr
brettw 2015/10/09 20:14:28 Can you remove this TODO?
Anand Mistry (off Chromium) 2015/10/12 04:28:56 Done.
52 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan 56 using_sanitizer =
57 is_asan || is_lsan || is_tsan || is_msan || is_ubsan || is_ubsan_vptr
53 58
54 assert(!using_sanitizer || is_clang, 59 assert(!using_sanitizer || is_clang,
55 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'") 60 "Sanitizers (is_*san) require setting is_clang = true in 'gn args'")
56 61
57 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The 62 # MSan only links Chrome properly in release builds (brettw -- 9/1/2015). The
58 # same is possibly true for the other non-ASan sanitizers. But regardless of 63 # same is possibly true for the other non-ASan sanitizers. But regardless of
59 # whether it links, one would normally never run a sanitizer in debug mode. 64 # whether it links, one would normally never run a sanitizer in debug mode.
60 # Running in debug mode probably indicates you forgot to set the "is_debug = 65 # Running in debug mode probably indicates you forgot to set the "is_debug =
61 # false" flag in the build args. ASan seems to run fine in debug mode. 66 # false" flag in the build args. ASan seems to run fine in debug mode.
62 # 67 #
63 # If you find a use-case where you want to compile a sanitizer in debug mode 68 # If you find a use-case where you want to compile a sanitizer in debug mode
64 # and have verified it works, ask brettw and we can consider removing it from 69 # and have verified it works, ask brettw and we can consider removing it from
65 # this condition. We may also be able to find another way to enable your case 70 # this condition. We may also be able to find another way to enable your case
66 # without having people accidentally get broken builds by compiling an 71 # without having people accidentally get broken builds by compiling an
67 # unsupported or unadvisable configurations. 72 # unsupported or unadvisable configurations.
68 # 73 #
69 # For one-off testing, just comment this assertion out. 74 # For one-off testing, just comment this assertion out.
70 assert(!is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan), 75 assert(
71 "Sanitizers should generally be used in release (set is_debug=false).") 76 !is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan || is_ubsan_vptr),
77 "Sanitizers should generally be used in release (set is_debug=false).")
OLDNEW
« no previous file with comments | « build/config/sanitizers/BUILD.gn ('k') | build/toolchain/gcc_toolchain.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698