Index: build/common.gypi |
diff --git a/build/common.gypi b/build/common.gypi |
index f67bf4f0f44327ee634c257636e0bef6484bcb98..b4066adaf0bbdb7f3de9c0fb8e1f22b2b8bc6863 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, |
@@ -2995,7 +3000,7 @@ |
['v8_use_external_startup_data==1', { |
'defines': ['V8_USE_EXTERNAL_STARTUP_DATA'], |
}], |
- ['use_lto==1 and (target_arch=="ia32" or target_arch=="x64")', { |
+ ['(use_lto==1 or cfi_vptr==1) and (target_arch=="ia32" or target_arch=="x64")', { |
Nico
2015/03/06 21:13:25
alternatively use_lto could be set to 1 automatica
|
# Required for third_party/zlib/crc_folding.c and various other code |
# that uses SSE. TODO(pcc): Remove this once we properly support |
# subtarget specific code generation in LLVM. |
@@ -5903,7 +5908,7 @@ |
], |
}, |
}], |
- ['use_lto==1 and clang==1', { |
+ ['(use_lto==1 or cfi_vptr==1) and clang==1', { |
'target_defaults': { |
'target_conditions': [ |
['_toolset=="target"', { |
@@ -5936,6 +5941,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! |