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

Side by Side Diff: build/config/sanitizers/BUILD.gn

Issue 1379503002: Add Undefined Behaviour sanitizer support to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. 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/compiler/compiler.gni ('k') | build/config/sanitizers/sanitizers.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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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/sanitizers/sanitizers.gni") 5 import("//build/config/sanitizers/sanitizers.gni")
6 6
7 # Contains the dependencies needed for sanitizers to link into executables and 7 # Contains the dependencies needed for sanitizers to link into executables and
8 # shared_libraries. Unconditionally depend upon this target as it is empty if 8 # shared_libraries. Unconditionally depend upon this target as it is empty if
9 # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false. 9 # |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false.
10 group("deps") { 10 group("deps") {
11 if (is_asan || is_lsan || is_tsan || is_msan) { 11 if (is_asan || is_lsan || is_tsan || is_msan || is_ubsan) {
12 public_configs = [ ":sanitizer_options_link_helper" ] 12 public_configs = [ ":sanitizer_options_link_helper" ]
13 deps = [ 13 deps = [
14 ":options_sources", 14 ":options_sources",
15 ] 15 ]
16 16
17 if (use_prebuilt_instrumented_libraries) { 17 if (use_prebuilt_instrumented_libraries) {
18 deps += [ "//third_party/instrumented_libraries:deps" ] 18 deps += [ "//third_party/instrumented_libraries:deps" ]
19 } 19 }
20 if (use_custom_libcxx) { 20 if (use_custom_libcxx) {
21 deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ] 21 deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ]
22 } 22 }
23 } 23 }
24 } 24 }
25 25
26 config("sanitizer_options_link_helper") { 26 config("sanitizer_options_link_helper") {
27 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ] 27 ldflags = [ "-Wl,-u_sanitizer_options_link_helper" ]
28 if (is_asan) { 28 if (is_asan) {
29 ldflags += [ "-fsanitize=address" ] 29 ldflags += [ "-fsanitize=address" ]
30 } 30 }
31 if (is_lsan) { 31 if (is_lsan) {
32 ldflags += [ "-fsanitize=leak" ] 32 ldflags += [ "-fsanitize=leak" ]
33 } 33 }
34 if (is_tsan) { 34 if (is_tsan) {
35 ldflags += [ "-fsanitize=thread" ] 35 ldflags += [ "-fsanitize=thread" ]
36 } 36 }
37 if (is_msan) { 37 if (is_msan) {
38 ldflags += [ "-fsanitize=memory" ] 38 ldflags += [ "-fsanitize=memory" ]
39 } 39 }
40 if (is_ubsan) {
41 ldflags += [ "-fsanitize=undefined" ]
42 }
40 } 43 }
41 44
42 source_set("options_sources") { 45 source_set("options_sources") {
43 visibility = [ 46 visibility = [
44 ":deps", 47 ":deps",
45 "//:gn_visibility", 48 "//:gn_visibility",
46 ] 49 ]
47 sources = [ 50 sources = [
48 "//build/sanitizers/sanitizer_options.cc", 51 "//build/sanitizers/sanitizer_options.cc",
49 ] 52 ]
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 115 }
113 if (is_msan) { 116 if (is_msan) {
114 msan_blacklist_path = 117 msan_blacklist_path =
115 rebase_path("//tools/msan/blacklist.txt", root_build_dir) 118 rebase_path("//tools/msan/blacklist.txt", root_build_dir)
116 cflags += [ 119 cflags += [
117 "-fsanitize=memory", 120 "-fsanitize=memory",
118 "-fsanitize-memory-track-origins=$msan_track_origins", 121 "-fsanitize-memory-track-origins=$msan_track_origins",
119 "-fsanitize-blacklist=$msan_blacklist_path", 122 "-fsanitize-blacklist=$msan_blacklist_path",
120 ] 123 ]
121 } 124 }
125 if (is_ubsan) {
126 ubsan_blacklist_path =
127 rebase_path("//tools/ubsan/blacklist.txt", root_build_dir)
128 cflags += [
129 # Yasm dies with an "Illegal instruction" error when bounds checking is
130 # enabled. See http://crbug.com/489901
131 # "-fsanitize=bounds",
132 "-fsanitize=float-divide-by-zero",
133 "-fsanitize=integer-divide-by-zero",
134 "-fsanitize=null",
135 "-fsanitize=object-size",
136 "-fsanitize=return",
137 "-fsanitize=returns-nonnull-attribute",
138 "-fsanitize=shift-exponent",
139 "-fsanitize=signed-integer-overflow",
140 "-fsanitize=unreachable",
141 "-fsanitize=vla-bound",
142 "-fsanitize-blacklist=$ubsan_blacklist_path",
143
144 # Employ the experimental PBQP register allocator to avoid slow
145 # compilation on files with too many basic blocks.
146 # See http://crbug.com/426271.
147 "-mllvm",
148 "-regalloc=pbqp",
149
150 # Speculatively use coalescing to slightly improve the code generated
151 # by PBQP regallocator. May increase compile time.
152 "-mllvm",
153 "-pbqp-coalescing",
154 ]
155 }
122 if (is_cfi && !is_nacl) { 156 if (is_cfi && !is_nacl) {
123 cfi_blacklist_path = 157 cfi_blacklist_path =
124 rebase_path("//tools/cfi/blacklist.txt", root_build_dir) 158 rebase_path("//tools/cfi/blacklist.txt", root_build_dir)
125 cflags += [ 159 cflags += [
126 "-flto", 160 "-flto",
127 "-fsanitize=cfi-vcall", 161 "-fsanitize=cfi-vcall",
128 "-fsanitize=cfi-derived-cast", 162 "-fsanitize=cfi-derived-cast",
129 "-fsanitize=cfi-unrelated-cast", 163 "-fsanitize=cfi-unrelated-cast",
130 "-fsanitize-blacklist=$cfi_blacklist_path", 164 "-fsanitize-blacklist=$cfi_blacklist_path",
131 ] 165 ]
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 207
174 if (use_custom_libcxx) { 208 if (use_custom_libcxx) {
175 cflags_cc += [ "-nostdinc++" ] 209 cflags_cc += [ "-nostdinc++" ]
176 include_dirs = [ 210 include_dirs = [
177 "//buildtools/third_party/libc++/trunk/include", 211 "//buildtools/third_party/libc++/trunk/include",
178 "//buildtools/third_party/libc++abi/trunk/include", 212 "//buildtools/third_party/libc++abi/trunk/include",
179 ] 213 ]
180 } 214 }
181 } 215 }
182 } 216 }
OLDNEW
« no previous file with comments | « build/config/compiler/compiler.gni ('k') | build/config/sanitizers/sanitizers.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698