Index: build/config/win/BUILD.gn |
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn |
index e00bfcb8e0754da5273b568b72f009f4088fd7eb..a7db829cd6b1bc33b5f81917f905f40927067b5c 100644 |
--- a/build/config/win/BUILD.gn |
+++ b/build/config/win/BUILD.gn |
@@ -252,6 +252,15 @@ config("common_linker_setup") { |
ldflags += [ "/DYNAMICBASE" ] |
} |
+ # Control Flow Guard (CFG) |
+ # https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx |
+ # /DYNAMICBASE (ASLR) is turned off in debug builds, therefore CFG can’t be |
+ # turned on either. |
+ if (!is_debug) { |
+ # Turn on CFG in msvc linker, regardless of compiler used. |
+ ldflags += [ "/guard:cf" ] |
+ } |
+ |
if (win_linker_timing) { |
ldflags += [ |
"/time", |
@@ -260,17 +269,6 @@ 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. |