Index: build/common.gypi |
diff --git a/build/common.gypi b/build/common.gypi |
index f67bf4f0f44327ee634c257636e0bef6484bcb98..f9319f5d9eb07d6798ee05a27e234494a7e5dcb1 100644 |
--- a/build/common.gypi |
+++ b/build/common.gypi |
@@ -646,6 +646,10 @@ |
# Libxkbcommon usage. |
'use_xkbcommon%': 0, |
+ # Control Flow Integrity for virtual calls. |
+ # See http://clang.llvm.org/docs/ControlFlowIntegrity.html |
+ 'cfi_vptr%': 0, |
+ |
'conditions': [ |
# A flag for POSIX platforms |
['OS=="win"', { |
@@ -1220,6 +1224,7 @@ |
'video_hole%': '<(video_hole)', |
'support_pre_M6_history_database%': '<(support_pre_M6_history_database)', |
'v8_use_external_startup_data%': '<(v8_use_external_startup_data)', |
+ 'cfi_vptr%': '<(cfi_vptr)', |
# Use system protobuf instead of bundled one. |
'use_system_protobuf%': 0, |
@@ -2380,6 +2385,10 @@ |
}, { |
'use_seccomp_bpf%': 0, |
}], |
+ |
+ ['cfi_vptr==1', { |
+ 'use_lto%': 1, |
+ }], |
], |
# older history files use fts2 instead of fts3 |
@@ -5936,6 +5945,20 @@ |
], |
}, |
}], |
+ ['cfi_vptr==1', { |
+ 'target_defaults': { |
+ 'target_conditions': [ |
+ ['_toolset=="target"', { |
+ 'cflags': [ |
+ '-fsanitize=cfi-vptr', |
+ ], |
+ 'ldflags': [ |
+ '-fsanitize=cfi-vptr', |
+ ], |
+ }], |
+ ], |
+ }, |
+ }], |
], |
'xcode_settings': { |
# DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT! |