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

Unified Diff: build/config/sanitizers/BUILD.gn

Issue 2131423002: Implement use_cfi_cast to optionally enable cast checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOINLINE 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 side-by-side diff with in-line comments
Download patch
Index: build/config/sanitizers/BUILD.gn
diff --git a/build/config/sanitizers/BUILD.gn b/build/config/sanitizers/BUILD.gn
index 0b099f41003757215e0a26feb6264833c449c49f..4a7de41ca63af98bbf6668103916af1d27d17d50 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",
@@ -249,17 +251,26 @@ config("asan_flags") {
}
config("cfi_flags") {
+ defines = []
cflags = []
if (is_cfi && !is_nacl) {
cfi_blacklist_path =
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",
+ ]
+
+ # TODO(krasin): remove CFI_CAST_CHECK, see https://crbug.com/626794.
+ defines += [ "CFI_CAST_CHECK" ]
Nico 2016/07/12 23:23:59 likewise
krasin1 2016/07/13 00:02:51 Done.
+ }
+
if (use_cfi_diag) {
cflags += [
"-fno-sanitize-trap=cfi",
@@ -270,7 +281,7 @@ config("cfi_flags") {
"-O1",
]
} else {
- defines = [ "CFI_ENFORCEMENT" ]
+ defines += [ "CFI_ENFORCEMENT" ]
}
}
}

Powered by Google App Engine
This is Rietveld 408576698