Index: build/config/win/BUILD.gn |
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn |
index 9b6ac7423f2b9d4d12bdea8302a200507d706e6e..ebcbb10ce742238d4b8af82b28af907a73536934 100644 |
--- a/build/config/win/BUILD.gn |
+++ b/build/config/win/BUILD.gn |
@@ -264,6 +264,17 @@ config("common_linker_setup") { |
} |
} |
+# Control Flow Guard (CFG) |
+# https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx |
+config("win_msvc_cfg") { |
+ # /DYNAMICBASE (ASLR) is turned off in debug builds, therefore CFG can’t be |
+ # turned on either. |
+ if (!is_clang && !is_debug) { |
+ cflags = [ "/guard:cf" ] |
+ ldflags = [ "/guard:cf" ] |
+ } |
+} |
+ |
# CRT -------------------------------------------------------------------------- |
# Configures how the runtime library (CRT) is going to be used. |