OLD | NEW |
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/clang/clang.gni") | 5 import("//build/config/clang/clang.gni") |
6 import("//build/config/compiler/compiler.gni") | 6 import("//build/config/compiler/compiler.gni") |
7 import("//build/config/sanitizers/sanitizers.gni") | 7 import("//build/config/sanitizers/sanitizers.gni") |
8 import("//build/config/win/visual_studio_version.gni") | 8 import("//build/config/win/visual_studio_version.gni") |
9 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
10 | 10 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 # Chrome.dll module like chrome_<base address>, where <base address> | 245 # Chrome.dll module like chrome_<base address>, where <base address> |
246 # typically changes with each launch. This in turn means that breakpoints in | 246 # typically changes with each launch. This in turn means that breakpoints in |
247 # Chrome.dll don't stick from one launch to the next. For this reason, we | 247 # Chrome.dll don't stick from one launch to the next. For this reason, we |
248 # turn ASLR off in debug builds. | 248 # turn ASLR off in debug builds. |
249 if (is_debug) { | 249 if (is_debug) { |
250 ldflags += [ "/DYNAMICBASE:NO" ] | 250 ldflags += [ "/DYNAMICBASE:NO" ] |
251 } else { | 251 } else { |
252 ldflags += [ "/DYNAMICBASE" ] | 252 ldflags += [ "/DYNAMICBASE" ] |
253 } | 253 } |
254 | 254 |
| 255 # Control Flow Guard (CFG) |
| 256 # https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx |
| 257 # /DYNAMICBASE (ASLR) is turned off in debug builds, therefore CFG can’t be |
| 258 # turned on either. |
| 259 if (!is_debug) { |
| 260 # Turn on CFG in msvc linker, regardless of compiler used. |
| 261 ldflags += [ "/guard:cf" ] |
| 262 } |
| 263 |
255 if (win_linker_timing) { | 264 if (win_linker_timing) { |
256 ldflags += [ | 265 ldflags += [ |
257 "/time", | 266 "/time", |
258 "/verbose:incr", | 267 "/verbose:incr", |
259 ] | 268 ] |
260 } | 269 } |
261 } | 270 } |
262 | 271 |
263 # Control Flow Guard (CFG) | |
264 # https://msdn.microsoft.com/en-us/library/windows/desktop/mt637065.aspx | |
265 config("win_msvc_cfg") { | |
266 # /DYNAMICBASE (ASLR) is turned off in debug builds, therefore CFG can’t be | |
267 # turned on either. | |
268 if (!is_clang && !is_debug) { | |
269 cflags = [ "/guard:cf" ] | |
270 ldflags = [ "/guard:cf" ] | |
271 } | |
272 } | |
273 | |
274 # CRT -------------------------------------------------------------------------- | 272 # CRT -------------------------------------------------------------------------- |
275 | 273 |
276 # Configures how the runtime library (CRT) is going to be used. | 274 # Configures how the runtime library (CRT) is going to be used. |
277 # See https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx for a reference of | 275 # See https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx for a reference of |
278 # what each value does. | 276 # what each value does. |
279 config("default_crt") { | 277 config("default_crt") { |
280 if (is_component_build) { | 278 if (is_component_build) { |
281 # Component mode: dynamic CRT. Since the library is shared, it requires | 279 # Component mode: dynamic CRT. Since the library is shared, it requires |
282 # exceptions or will give errors about things not matching, so keep | 280 # exceptions or will give errors about things not matching, so keep |
283 # exceptions on. | 281 # exceptions on. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 412 |
415 # Internal stuff -------------------------------------------------------------- | 413 # Internal stuff -------------------------------------------------------------- |
416 | 414 |
417 # Config used by the MIDL template to disable warnings. | 415 # Config used by the MIDL template to disable warnings. |
418 config("midl_warnings") { | 416 config("midl_warnings") { |
419 if (is_clang) { | 417 if (is_clang) { |
420 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". | 418 # MIDL generates code like "#endif !_MIDL_USE_GUIDDEF_". |
421 cflags = [ "-Wno-extra-tokens" ] | 419 cflags = [ "-Wno-extra-tokens" ] |
422 } | 420 } |
423 } | 421 } |
OLD | NEW |