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

Unified 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, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/config/compiler/compiler.gni ('k') | build/config/sanitizers/sanitizers.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/sanitizers/BUILD.gn
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn
index 65bdbe419fd407b0831dee47339f6e028a582e61..c06e4e7721fe8a4aa184632b5045cb3848ebb65c 100644
--- a/build/config/sanitizers/BUILD.gn
+++ b/build/config/sanitizers/BUILD.gn
@@ -8,7 +8,7 @@ import("//build/config/sanitizers/sanitizers.gni")
# shared_libraries. Unconditionally depend upon this target as it is empty if
# |is_asan|, |is_lsan|, |is_tsan|, |is_msan| and |use_custom_libcxx| are false.
group("deps") {
- if (is_asan || is_lsan || is_tsan || is_msan) {
+ if (is_asan || is_lsan || is_tsan || is_msan || is_ubsan) {
public_configs = [ ":sanitizer_options_link_helper" ]
deps = [
":options_sources",
@@ -37,6 +37,9 @@ config("sanitizer_options_link_helper") {
if (is_msan) {
ldflags += [ "-fsanitize=memory" ]
}
+ if (is_ubsan) {
+ ldflags += [ "-fsanitize=undefined" ]
+ }
}
source_set("options_sources") {
@@ -119,6 +122,37 @@ config("default_sanitizer_flags") {
"-fsanitize-blacklist=$msan_blacklist_path",
]
}
+ if (is_ubsan) {
+ ubsan_blacklist_path =
+ rebase_path("//tools/ubsan/blacklist.txt", root_build_dir)
+ cflags += [
+ # Yasm dies with an "Illegal instruction" error when bounds checking is
+ # enabled. See http://crbug.com/489901
+ # "-fsanitize=bounds",
+ "-fsanitize=float-divide-by-zero",
+ "-fsanitize=integer-divide-by-zero",
+ "-fsanitize=null",
+ "-fsanitize=object-size",
+ "-fsanitize=return",
+ "-fsanitize=returns-nonnull-attribute",
+ "-fsanitize=shift-exponent",
+ "-fsanitize=signed-integer-overflow",
+ "-fsanitize=unreachable",
+ "-fsanitize=vla-bound",
+ "-fsanitize-blacklist=$ubsan_blacklist_path",
+
+ # Employ the experimental PBQP register allocator to avoid slow
+ # compilation on files with too many basic blocks.
+ # See http://crbug.com/426271.
+ "-mllvm",
+ "-regalloc=pbqp",
+
+ # Speculatively use coalescing to slightly improve the code generated
+ # by PBQP regallocator. May increase compile time.
+ "-mllvm",
+ "-pbqp-coalescing",
+ ]
+ }
if (is_cfi && !is_nacl) {
cfi_blacklist_path =
rebase_path("//tools/cfi/blacklist.txt", root_build_dir)
« 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