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

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

Issue 2130893002: [sanitizers] asan_globals GN option (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 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') | no next file » | 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
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 # Helper variable for testing builds with disabled libfuzzer. 71 # Helper variable for testing builds with disabled libfuzzer.
72 # Not for client use. 72 # Not for client use.
73 disable_libfuzzer = false 73 disable_libfuzzer = false
74 74
75 # Value for -fsanitize-coverage flag. Setting this causes 75 # Value for -fsanitize-coverage flag. Setting this causes
76 # use_sanitizer_coverage to be enabled. 76 # use_sanitizer_coverage to be enabled.
77 # Default value when unset and use_afl=true: 77 # Default value when unset and use_afl=true:
78 # trace-pc 78 # trace-pc
79 # Default value when unset and use_sanitizer_coverage=true: 79 # Default value when unset and use_sanitizer_coverage=true:
80 # edge,indirect-calls,8bit-counters 80 # edge,indirect-calls,8bit-counters
81
82 sanitizer_coverage_flags = "" 81 sanitizer_coverage_flags = ""
83 } 82 }
84 83
85 # Args that are in turn dependent on other args must be in a separate 84 # Args that are in turn dependent on other args must be in a separate
86 # declare_args block. User overrides are only applied at the end of a 85 # declare_args block. User overrides are only applied at the end of a
87 # declare_args block. 86 # declare_args block.
88 declare_args() { 87 declare_args() {
89 # Use libc++ (buildtools/third_party/libc++ and 88 # Use libc++ (buildtools/third_party/libc++ and
90 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library. 89 # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
91 # This is intended to be used for instrumented builds. 90 # This is intended to be used for instrumented builds.
92 use_custom_libcxx = 91 use_custom_libcxx =
93 (is_asan && is_linux && !is_chromeos) || is_tsan || is_msan || is_ubsan || 92 (is_asan && is_linux && !is_chromeos) || is_tsan || is_msan || is_ubsan ||
94 is_ubsan_security || use_libfuzzer || use_afl 93 is_ubsan_security || use_libfuzzer || use_afl
95 94
96 # Enable -fsanitize-coverage. 95 # Enable -fsanitize-coverage.
97 use_sanitizer_coverage = 96 use_sanitizer_coverage =
98 use_libfuzzer || use_afl || sanitizer_coverage_flags != "" 97 use_libfuzzer || use_afl || sanitizer_coverage_flags != ""
98
99 # Detect overflow/underflow for global objects.
100 #
101 # Android build relies on -Wl,--gc-sections removing unreachable code.
102 # ASan instrumentation for globals inhibits this and results in a
103 # library with unresolvable relocations.
104 # TODO(eugenis): find a way to reenable this.
105 #
106 # Mac: http://crbug.com/352073
107 asan_globals = !is_android && !is_mac
99 } 108 }
100 109
101 if (use_afl && sanitizer_coverage_flags == "") { 110 if (use_afl && sanitizer_coverage_flags == "") {
102 sanitizer_coverage_flags = "trace-pc" 111 sanitizer_coverage_flags = "trace-pc"
103 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") { 112 } else if (use_sanitizer_coverage && sanitizer_coverage_flags == "") {
104 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters" 113 sanitizer_coverage_flags = "edge,indirect-calls,8bit-counters"
105 } 114 }
106 115
107 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan || 116 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan ||
108 is_ubsan_null || is_ubsan_vptr || is_ubsan_security 117 is_ubsan_null || is_ubsan_vptr || is_ubsan_security
(...skipping 12 matching lines...) Expand all
121 # 130 #
122 # If you find a use-case where you want to compile a sanitizer in debug mode 131 # If you find a use-case where you want to compile a sanitizer in debug mode
123 # and have verified it works, ask brettw and we can consider removing it from 132 # and have verified it works, ask brettw and we can consider removing it from
124 # this condition. We may also be able to find another way to enable your case 133 # this condition. We may also be able to find another way to enable your case
125 # without having people accidentally get broken builds by compiling an 134 # without having people accidentally get broken builds by compiling an
126 # unsupported or unadvisable configurations. 135 # unsupported or unadvisable configurations.
127 # 136 #
128 # For one-off testing, just comment this assertion out. 137 # For one-off testing, just comment this assertion out.
129 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr), 138 assert(!is_debug || !(is_msan || is_ubsan || is_ubsan_null || is_ubsan_vptr),
130 "Sanitizers should generally be used in release (set is_debug=false).") 139 "Sanitizers should generally be used in release (set is_debug=false).")
OLDNEW
« no previous file with comments | « build/config/sanitizers/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698