summaryrefslogtreecommitdiff
path: root/chromium/build/config/win/BUILD.gn
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/build/config/win/BUILD.gn')
-rw-r--r--chromium/build/config/win/BUILD.gn47
1 files changed, 30 insertions, 17 deletions
diff --git a/chromium/build/config/win/BUILD.gn b/chromium/build/config/win/BUILD.gn
index 80bfa75f2e1..1f6bc13e087 100644
--- a/chromium/build/config/win/BUILD.gn
+++ b/chromium/build/config/win/BUILD.gn
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import("//build/config/chrome_build.gni")
+import("//build/config/c++/c++.gni")
import("//build/config/clang/clang.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/sanitizers/sanitizers.gni")
@@ -61,8 +62,6 @@ config("compiler") {
"/Zc:sizedDealloc-",
]
- # Building with Clang on Windows is a work in progress and very
- # experimental. See crbug.com/82385.
if (is_clang) {
cflags += [ "-fmsc-version=1911" ]
@@ -85,6 +84,14 @@ config("compiler") {
lib_dirs = [ "$clang_base_path/lib/clang/$clang_version/lib/windows" ]
}
+ if (use_lld) {
+ # /Brepro lets the compiler not write the mtime field in the .obj output.
+ # link.exe /incremental relies on this field to work correctly, but lld
+ # never looks at this timestamp, so it's safe to pass this flag with
+ # lld and get more deterministic compiler output in return.
+ cflags += [ "/Brepro" ]
+ }
+
# /PROFILE ensures that the PDB file contains FIXUP information (growing the
# PDB file by about 5%) but does not otherwise alter the output binary. This
# information is used by the Syzygy optimization tool when decomposing the
@@ -217,13 +224,26 @@ config("runtime_library") {
# However it is prohibited when using /analyze
defines += [ "_USING_V110_SDK71_" ]
}
+
+ if (use_custom_libcxx) {
+ cflags_cc = [ "-I" + rebase_path("$libcxx_prefix/include", root_build_dir) ]
+ if (libcpp_is_static) {
+ defines += [ "_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS" ]
+ }
+
+ # Prevent libc++ from embedding linker flags to try to automatically link
+ # against its runtime library. This is unnecessary with our build system,
+ # and can also result in build failures if libc++'s name for a library does
+ # not match ours.
+ defines += [ "_LIBCPP_NO_AUTO_LINK" ]
+ }
}
# Sets the default Windows build version. This is separated because some
# targets need to manually override it for their compiles.
config("winver") {
defines = [
- "NTDDI_VERSION=0x0A000000",
+ "NTDDI_VERSION=0x0A000002",
"_WIN32_WINNT=0x0A00",
"WINVER=0x0A00",
]
@@ -262,20 +282,9 @@ config("common_linker_setup") {
"/ignore:4199",
"/ignore:4221",
"/NXCOMPAT",
+ "/DYNAMICBASE",
]
- # ASLR makes debugging with windbg difficult because Chrome.exe and
- # Chrome.dll share the same base name. As result, windbg will name the
- # Chrome.dll module like chrome_<base address>, where <base address>
- # typically changes with each launch. This in turn means that breakpoints in
- # Chrome.dll don't stick from one launch to the next. For this reason, we
- # turn ASLR off in debug builds.
- if (is_debug) {
- ldflags += [ "/DYNAMICBASE:NO" ]
- } else {
- ldflags += [ "/DYNAMICBASE" ]
- }
-
if (win_linker_timing) {
ldflags += [
"/time",
@@ -289,8 +298,9 @@ config("cfi_linker") {
# 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.
- # TODO(thakis): Turn this on with lld once supported, https://crbug.com/693709
- if (!is_debug && !use_lld) {
+ # CFG seems to lead to random corruption with incremental linking so turn off
+ # CFG in component builds. https://crbug.com/812421
+ if (!is_debug && !is_component_build) {
# Turn on CFG in msvc linker, regardless of compiler used. Turn off CFG for
# longjmp (new in VS 2017) because it relies on compiler support which we do
# not have enabled.
@@ -373,6 +383,9 @@ config("windowed") {
incremental_linking_on_switch = [ "/INCREMENTAL" ]
incremental_linking_off_switch = [ "/INCREMENTAL:NO" ]
+if (use_lld) {
+ incremental_linking_on_switch += [ "/OPT:NOREF" ]
+}
# Disable incremental linking for syzyasan, enable for debug builds and all
# component builds - any builds where performance is not job one.