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

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

Issue 1386713002: Make GN use_custom_libcxx work properly with sanitizers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo 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 | « no previous file | tools/gn/functions.cc » ('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.
20 is_ubsan = false 20 is_ubsan = false
21 21
22 # Use libc++ (buildtools/third_party/libc++ and
23 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
24 # This is intended to be used for instrumented builds.
25 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan
26
27 # Track where uninitialized memory originates from. From fastest to slowest: 22 # Track where uninitialized memory originates from. From fastest to slowest:
28 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the 23 # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the
29 # chain of stores leading from allocation site to use site. 24 # chain of stores leading from allocation site to use site.
30 msan_track_origins = 2 25 msan_track_origins = 2
31 26
32 # Use dynamic libraries instrumented by one of the sanitizers instead of the 27 # Use dynamic libraries instrumented by one of the sanitizers instead of the
33 # standard system libraries. Set this flag to download prebuilt binaries from 28 # standard system libraries. Set this flag to download prebuilt binaries from
34 # GCS. 29 # GCS.
35 use_prebuilt_instrumented_libraries = false 30 use_prebuilt_instrumented_libraries = false
36 31
37 # Enable building with SyzyAsan which can find certain types of memory 32 # Enable building with SyzyAsan which can find certain types of memory
38 # errors. Only works on Windows. See 33 # errors. Only works on Windows. See
39 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo 34 # https://code.google.com/p/sawbuck/wiki/SyzyASanHowTo
40 is_syzyasan = false 35 is_syzyasan = false
41 36
42 # Compile with Control Flow Integrity to protect virtual calls and casts. 37 # Compile with Control Flow Integrity to protect virtual calls and casts.
43 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html 38 # See http://clang.llvm.org/docs/ControlFlowIntegrity.html
44 is_cfi = false 39 is_cfi = false
45 40
46 # By default, Control Flow Integrity will crash the program if it detects a 41 # By default, Control Flow Integrity will crash the program if it detects a
47 # violation. Set this to true to print detailed diagnostics instead. 42 # violation. Set this to true to print detailed diagnostics instead.
48 use_cfi_diag = false 43 use_cfi_diag = false
49 } 44 }
50 45
46 # Args that are in turn dependent on other args must be in a separate
47 # declare_args block. User overrides are only applied at the end of a
48 # declare_args block.
49 declare_args() {
50 # Use libc++ (buildtools/third_party/libc++ and
51 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
52 # This is intended to be used for instrumented builds.
53 use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan
54 }
55
51 # TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr 56 # TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr
52 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan 57 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan
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(!is_debug || !(is_msan || is_lsan || is_tsan || is_ubsan),
71 "Sanitizers should generally be used in release (set is_debug=false).") 76 "Sanitizers should generally be used in release (set is_debug=false).")
OLDNEW
« no previous file with comments | « no previous file | tools/gn/functions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698