Index: build/config/sanitizers/BUILD.gn |
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn |
index 0b099f41003757215e0a26feb6264833c449c49f..f03c98f279fa75dc3eb4ba450974ea7eb4626578 100644 |
--- a/build/config/sanitizers/BUILD.gn |
+++ b/build/config/sanitizers/BUILD.gn |
@@ -155,11 +155,13 @@ config("default_sanitizer_ldflags") { |
} |
if (is_cfi && !is_nacl) { |
- ldflags += [ |
- "-fsanitize=cfi-vcall", |
- "-fsanitize=cfi-derived-cast", |
- "-fsanitize=cfi-unrelated-cast", |
- ] |
+ ldflags += [ "-fsanitize=cfi-vcall" ] |
+ if (use_cfi_cast) { |
+ ldflags += [ |
+ "-fsanitize=cfi-derived-cast", |
+ "-fsanitize=cfi-unrelated-cast", |
+ ] |
+ } |
if (use_cfi_diag) { |
ldflags += [ |
"-fno-sanitize-trap=cfi", |
@@ -255,11 +257,16 @@ config("cfi_flags") { |
rebase_path("//tools/cfi/blacklist.txt", root_build_dir) |
cflags += [ |
"-fsanitize=cfi-vcall", |
- "-fsanitize=cfi-derived-cast", |
- "-fsanitize=cfi-unrelated-cast", |
"-fsanitize-blacklist=$cfi_blacklist_path", |
] |
+ if (use_cfi_cast) { |
+ cflags += [ |
+ "-fsanitize=cfi-derived-cast", |
+ "-fsanitize=cfi-unrelated-cast", |
+ ] |
+ } |
+ |
if (use_cfi_diag) { |
cflags += [ |
"-fno-sanitize-trap=cfi", |