update win build.gns

This commit is contained in:
Alexander Frick 2024-07-15 13:27:48 -05:00
parent 7ba8beaeef
commit f21569d176
7 changed files with 234 additions and 337 deletions

View file

@ -11,7 +11,6 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/control_flow_guard.gni")
import("//build/config/win/visual_studio_version.gni")
import("//build/timestamp.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/toolchain.gni")
@ -163,8 +162,8 @@ config("compiler") {
# Enable ANSI escape codes if something emulating them is around (cmd.exe
# doesn't understand ANSI escape codes by default). Make sure to not enable
# this if goma/remoteexec is in use, because this will lower cache hits.
if (!use_goma && !use_remoteexec &&
# this if remoteexec is in use, because this will lower cache hits.
if (!use_remoteexec &&
exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
"True") {
cflags += [ "-fansi-escape-codes" ]
@ -176,7 +175,7 @@ config("compiler") {
}
# Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
if (use_lld && !use_thin_lto && cc_wrapper == "") {
# /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
@ -446,10 +445,12 @@ config("cfi_linker") {
# tests with the full browser.
config("delayloads") {
ldflags = [
"/DELAYLOAD:api-ms-win-core-synch-l1-2-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
"/DELAYLOAD:advapi32.dll",
"/DELAYLOAD:bcryptprimitives.dll",
"/DELAYLOAD:comctl32.dll",
"/DELAYLOAD:comdlg32.dll",
"/DELAYLOAD:credui.dll",
@ -461,6 +462,7 @@ config("delayloads") {
"/DELAYLOAD:dxgi.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:fontsub.dll",
"/DELAYLOAD:gdi32.dll",
"/DELAYLOAD:hid.dll",
"/DELAYLOAD:imagehlp.dll",
@ -544,15 +546,9 @@ config("release_crt") {
if (is_component_build) {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
# On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
@ -562,15 +558,10 @@ config("release_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -583,12 +574,14 @@ config("dynamic_crt") {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=msvcrtd.lib" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. Rust defaults to the dynamic+release library, which
# we remove here, and then replace. See
# https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Clink-arg=/nodefaultlib:msvcrt.lib",
"-Clink-arg=msvcrtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
@ -596,16 +589,9 @@ config("dynamic_crt") {
} else {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
@ -618,12 +604,15 @@ config("static_crt") {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=libcmtd.lib" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. We tell Rust that we're using the static CRT but
# remove the release library that it chooses, and replace with the debug
# library. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Ctarget-feature=+crt-static",
"-Clink-arg=/nodefaultlib:libcmt.lib",
"-Clink-arg=libcmtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
@ -631,16 +620,10 @@ config("static_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -680,7 +663,7 @@ config("default_incremental_linking") {
# lld.
ldflags += [ "/OPT:NOREF" ]
# TODO(crbug.com/1444129): Mixing incremental and icf produces an error
# TODO(crbug.com/40267564): Mixing incremental and icf produces an error
# in lld-link.
ldflags += [ "/OPT:NOICF" ]
}

View file

@ -11,7 +11,6 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/control_flow_guard.gni")
import("//build/config/win/visual_studio_version.gni")
import("//build/timestamp.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/toolchain.gni")
@ -127,10 +126,10 @@ config("compiler") {
# microarchitecture. MSVC only supports a subset of architectures, and the
# next step after SSE2 will be AVX.
# "/fp:fast", enables FMA.
# "/arch:AVX2", for AVX2
# "/arch:AVX512", for AVX2
if (current_cpu == "x86" || current_cpu == "x64") {
cflags += [
"/arch:AVX2",
"/arch:AVX512",
"-msse3",
"-mssse3",
"-msse4.1",
@ -174,8 +173,8 @@ config("compiler") {
# Enable ANSI escape codes if something emulating them is around (cmd.exe
# doesn't understand ANSI escape codes by default). Make sure to not enable
# this if goma/remoteexec is in use, because this will lower cache hits.
if (!use_goma && !use_remoteexec &&
# this if remoteexec is in use, because this will lower cache hits.
if (!use_remoteexec &&
exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
"True") {
cflags += [ "-fansi-escape-codes" ]
@ -187,7 +186,7 @@ config("compiler") {
}
# Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
if (use_lld && !use_thin_lto && cc_wrapper == "") {
# /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
@ -457,10 +456,12 @@ config("cfi_linker") {
# tests with the full browser.
config("delayloads") {
ldflags = [
"/DELAYLOAD:api-ms-win-core-synch-l1-2-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
"/DELAYLOAD:advapi32.dll",
"/DELAYLOAD:bcryptprimitives.dll",
"/DELAYLOAD:comctl32.dll",
"/DELAYLOAD:comdlg32.dll",
"/DELAYLOAD:credui.dll",
@ -472,6 +473,7 @@ config("delayloads") {
"/DELAYLOAD:dxgi.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:fontsub.dll",
"/DELAYLOAD:gdi32.dll",
"/DELAYLOAD:hid.dll",
"/DELAYLOAD:imagehlp.dll",
@ -555,15 +557,9 @@ config("release_crt") {
if (is_component_build) {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
# On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
@ -573,15 +569,10 @@ config("release_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -594,12 +585,14 @@ config("dynamic_crt") {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=msvcrtd.lib" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. Rust defaults to the dynamic+release library, which
# we remove here, and then replace. See
# https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Clink-arg=/nodefaultlib:msvcrt.lib",
"-Clink-arg=msvcrtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
@ -607,16 +600,9 @@ config("dynamic_crt") {
} else {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
@ -629,12 +615,15 @@ config("static_crt") {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=libcmtd.lib" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. We tell Rust that we're using the static CRT but
# remove the release library that it chooses, and replace with the debug
# library. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Ctarget-feature=+crt-static",
"-Clink-arg=/nodefaultlib:libcmt.lib",
"-Clink-arg=libcmtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
@ -642,16 +631,10 @@ config("static_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -691,7 +674,7 @@ config("default_incremental_linking") {
# lld.
ldflags += [ "/OPT:NOREF" ]
# TODO(crbug.com/1444129): Mixing incremental and icf produces an error
# TODO(crbug.com/40267564): Mixing incremental and icf produces an error
# in lld-link.
ldflags += [ "/OPT:NOICF" ]
}

View file

@ -11,7 +11,6 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/control_flow_guard.gni")
import("//build/config/win/visual_studio_version.gni")
import("//build/timestamp.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/toolchain.gni")
@ -144,8 +143,8 @@ config("compiler") {
# Enable ANSI escape codes if something emulating them is around (cmd.exe
# doesn't understand ANSI escape codes by default). Make sure to not enable
# this if goma/remoteexec is in use, because this will lower cache hits.
if (!use_goma && !use_remoteexec &&
# this if remoteexec is in use, because this will lower cache hits.
if (!use_remoteexec &&
exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
"True") {
cflags += [ "-fansi-escape-codes" ]
@ -157,7 +156,7 @@ config("compiler") {
}
# Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
if (use_lld && !use_thin_lto && cc_wrapper == "") {
# /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
@ -426,10 +425,12 @@ config("cfi_linker") {
# tests with the full browser.
config("delayloads") {
ldflags = [
"/DELAYLOAD:api-ms-win-core-synch-l1-2-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
"/DELAYLOAD:advapi32.dll",
"/DELAYLOAD:bcryptprimitives.dll",
"/DELAYLOAD:comctl32.dll",
"/DELAYLOAD:comdlg32.dll",
"/DELAYLOAD:credui.dll",
@ -441,6 +442,7 @@ config("delayloads") {
"/DELAYLOAD:dxgi.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:fontsub.dll",
"/DELAYLOAD:gdi32.dll",
"/DELAYLOAD:hid.dll",
"/DELAYLOAD:imagehlp.dll",
@ -524,15 +526,9 @@ config("release_crt") {
if (is_component_build) {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
# On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
@ -542,15 +538,10 @@ config("release_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -563,12 +554,14 @@ config("dynamic_crt") {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=msvcrtd.lib" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. Rust defaults to the dynamic+release library, which
# we remove here, and then replace. See
# https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Clink-arg=/nodefaultlib:msvcrt.lib",
"-Clink-arg=msvcrtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
@ -576,16 +569,9 @@ config("dynamic_crt") {
} else {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
@ -598,12 +584,15 @@ config("static_crt") {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=libcmtd.lib" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. We tell Rust that we're using the static CRT but
# remove the release library that it chooses, and replace with the debug
# library. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Ctarget-feature=+crt-static",
"-Clink-arg=/nodefaultlib:libcmt.lib",
"-Clink-arg=libcmtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
@ -611,16 +600,10 @@ config("static_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -660,7 +643,7 @@ config("default_incremental_linking") {
# lld.
ldflags += [ "/OPT:NOREF" ]
# TODO(crbug.com/1444129): Mixing incremental and icf produces an error
# TODO(crbug.com/40267564): Mixing incremental and icf produces an error
# in lld-link.
ldflags += [ "/OPT:NOICF" ]
}

View file

@ -11,7 +11,6 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/control_flow_guard.gni")
import("//build/config/win/visual_studio_version.gni")
import("//build/timestamp.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/toolchain.gni")
@ -138,8 +137,8 @@ config("compiler") {
# Enable ANSI escape codes if something emulating them is around (cmd.exe
# doesn't understand ANSI escape codes by default). Make sure to not enable
# this if goma/remoteexec is in use, because this will lower cache hits.
if (!use_goma && !use_remoteexec &&
# this if remoteexec is in use, because this will lower cache hits.
if (!use_remoteexec &&
exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
"True") {
cflags += [ "-fansi-escape-codes" ]
@ -151,7 +150,7 @@ config("compiler") {
}
# Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
if (use_lld && !use_thin_lto && cc_wrapper == "") {
# /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
@ -420,10 +419,12 @@ config("cfi_linker") {
# tests with the full browser.
config("delayloads") {
ldflags = [
"/DELAYLOAD:api-ms-win-core-synch-l1-2-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
"/DELAYLOAD:advapi32.dll",
"/DELAYLOAD:bcryptprimitives.dll",
"/DELAYLOAD:comctl32.dll",
"/DELAYLOAD:comdlg32.dll",
"/DELAYLOAD:credui.dll",
@ -435,6 +436,7 @@ config("delayloads") {
"/DELAYLOAD:dxgi.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:fontsub.dll",
"/DELAYLOAD:gdi32.dll",
"/DELAYLOAD:hid.dll",
"/DELAYLOAD:imagehlp.dll",
@ -518,15 +520,9 @@ config("release_crt") {
if (is_component_build) {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
# On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
@ -536,15 +532,10 @@ config("release_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -557,12 +548,14 @@ config("dynamic_crt") {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=msvcrtd.lib" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. Rust defaults to the dynamic+release library, which
# we remove here, and then replace. See
# https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Clink-arg=/nodefaultlib:msvcrt.lib",
"-Clink-arg=msvcrtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
@ -570,16 +563,9 @@ config("dynamic_crt") {
} else {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
@ -592,12 +578,15 @@ config("static_crt") {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=libcmtd.lib" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. We tell Rust that we're using the static CRT but
# remove the release library that it chooses, and replace with the debug
# library. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Ctarget-feature=+crt-static",
"-Clink-arg=/nodefaultlib:libcmt.lib",
"-Clink-arg=libcmtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
@ -605,16 +594,10 @@ config("static_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -654,7 +637,7 @@ config("default_incremental_linking") {
# lld.
ldflags += [ "/OPT:NOREF" ]
# TODO(crbug.com/1444129): Mixing incremental and icf produces an error
# TODO(crbug.com/40267564): Mixing incremental and icf produces an error
# in lld-link.
ldflags += [ "/OPT:NOICF" ]
}

View file

@ -11,7 +11,6 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/control_flow_guard.gni")
import("//build/config/win/visual_studio_version.gni")
import("//build/timestamp.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/toolchain.gni")
@ -142,8 +141,8 @@ config("compiler") {
# Enable ANSI escape codes if something emulating them is around (cmd.exe
# doesn't understand ANSI escape codes by default). Make sure to not enable
# this if goma/remoteexec is in use, because this will lower cache hits.
if (!use_goma && !use_remoteexec &&
# this if remoteexec is in use, because this will lower cache hits.
if (!use_remoteexec &&
exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
"True") {
cflags += [ "-fansi-escape-codes" ]
@ -155,7 +154,7 @@ config("compiler") {
}
# Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
if (use_lld && !use_thin_lto && cc_wrapper == "") {
# /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
@ -424,10 +423,12 @@ config("cfi_linker") {
# tests with the full browser.
config("delayloads") {
ldflags = [
"/DELAYLOAD:api-ms-win-core-synch-l1-2-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
"/DELAYLOAD:advapi32.dll",
"/DELAYLOAD:bcryptprimitives.dll",
"/DELAYLOAD:comctl32.dll",
"/DELAYLOAD:comdlg32.dll",
"/DELAYLOAD:credui.dll",
@ -439,6 +440,7 @@ config("delayloads") {
"/DELAYLOAD:dxgi.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:fontsub.dll",
"/DELAYLOAD:gdi32.dll",
"/DELAYLOAD:hid.dll",
"/DELAYLOAD:imagehlp.dll",
@ -522,15 +524,9 @@ config("release_crt") {
if (is_component_build) {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
# On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
@ -540,15 +536,10 @@ config("release_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -561,12 +552,14 @@ config("dynamic_crt") {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=msvcrtd.lib" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. Rust defaults to the dynamic+release library, which
# we remove here, and then replace. See
# https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Clink-arg=/nodefaultlib:msvcrt.lib",
"-Clink-arg=msvcrtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
@ -574,16 +567,9 @@ config("dynamic_crt") {
} else {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
@ -596,12 +582,15 @@ config("static_crt") {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=libcmtd.lib" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. We tell Rust that we're using the static CRT but
# remove the release library that it chooses, and replace with the debug
# library. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Ctarget-feature=+crt-static",
"-Clink-arg=/nodefaultlib:libcmt.lib",
"-Clink-arg=libcmtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
@ -609,16 +598,10 @@ config("static_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -658,7 +641,7 @@ config("default_incremental_linking") {
# lld.
ldflags += [ "/OPT:NOREF" ]
# TODO(crbug.com/1444129): Mixing incremental and icf produces an error
# TODO(crbug.com/40267564): Mixing incremental and icf produces an error
# in lld-link.
ldflags += [ "/OPT:NOICF" ]
}

View file

@ -6,7 +6,6 @@ import("//build/config/apple/symbols.gni")
import("//build/config/c++/c++.gni")
import("//build/config/mac/mac_sdk.gni")
import("//build/config/sysroot.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/siso.gni")
@ -45,7 +44,7 @@ config("compiler") {
if (current_cpu == "x64") {
cflags += [ "-O3", "-march=x86-64-v3", "-ffp-contract=fast", ]
ldflags += [ "-Wl,-O3", "-Wl,-mllvm,-march=x86-64-v3", "-Wl,-mllvm,-fp-contract=fast", "-Wl,-mllvm,-import-instr-limit=30", "-Wl,-mllvm,-import-hot-multiplier=15", "-Wl,-mllvm,-import-cold-multiplier=2", ]
ldflags += [ "-Wl,-O3", "-Wl,-mllvm,-march=x86-64-v3", "-Wl,-mllvm,-fp-contract=fast", "-Wl,-mllvm,-import-instr-limit=30", ]
}
if (save_unstripped_output) {
@ -98,7 +97,7 @@ config("mac_dynamic_flags") {
}
}
# When building with Goma, all inputs must be relative to the build directory.
# When building with RBE, all inputs must be relative to the build directory.
# If using the system Xcode, which typically resides outside the build root, a
# symlink to the SDK is created in the build directory, and the path to that
# link is stored in $mac_sdk_path. If an action references a file in the SDK as
@ -110,8 +109,8 @@ config("mac_dynamic_flags") {
#
# The symbolic link for $mac_sdk_path is set up by
# //build/config/apple/sdk_info.py in //build/config/mac/mac_sdk.gni.
if (use_system_xcode && (use_goma || use_remoteexec || use_siso) &&
target_os == "mac" && current_toolchain == default_toolchain) {
if (use_system_xcode && (use_remoteexec || use_siso) && target_os == "mac" &&
current_toolchain == default_toolchain) {
action("sdk_inputs") {
script = "//build/noop.py"
outputs = [

View file

@ -11,7 +11,6 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/win/control_flow_guard.gni")
import("//build/config/win/visual_studio_version.gni")
import("//build/timestamp.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/rbe.gni")
import("//build/toolchain/toolchain.gni")
@ -150,8 +149,8 @@ config("compiler") {
# Enable ANSI escape codes if something emulating them is around (cmd.exe
# doesn't understand ANSI escape codes by default). Make sure to not enable
# this if goma/remoteexec is in use, because this will lower cache hits.
if (!use_goma && !use_remoteexec &&
# this if remoteexec is in use, because this will lower cache hits.
if (!use_remoteexec &&
exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
"True") {
cflags += [ "-fansi-escape-codes" ]
@ -163,7 +162,7 @@ config("compiler") {
}
# Disabled with cc_wrapper because of https://github.com/mozilla/sccache/issues/264
if (use_lld && !use_thin_lto && (is_clang || !use_goma) && cc_wrapper == "") {
if (use_lld && !use_thin_lto && cc_wrapper == "") {
# /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
@ -433,10 +432,12 @@ config("cfi_linker") {
# tests with the full browser.
config("delayloads") {
ldflags = [
"/DELAYLOAD:api-ms-win-core-synch-l1-2-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
"/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
"/DELAYLOAD:advapi32.dll",
"/DELAYLOAD:bcryptprimitives.dll",
"/DELAYLOAD:comctl32.dll",
"/DELAYLOAD:comdlg32.dll",
"/DELAYLOAD:credui.dll",
@ -448,6 +449,7 @@ config("delayloads") {
"/DELAYLOAD:dxgi.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:fontsub.dll",
"/DELAYLOAD:gdi32.dll",
"/DELAYLOAD:hid.dll",
"/DELAYLOAD:imagehlp.dll",
@ -531,15 +533,9 @@ config("release_crt") {
if (is_component_build) {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
# On Windows, including libcpmt[d]/msvcprt[d] explicitly links the C++
@ -549,15 +545,10 @@ config("release_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly. Once
# https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -570,12 +561,14 @@ config("dynamic_crt") {
# This pulls in the DLL debug CRT and defines _DEBUG
cflags = [ "/MDd" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=msvcrtd.lib" ]
# /MDd specifies msvcrtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. Rust defaults to the dynamic+release library, which
# we remove here, and then replace. See
# https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Clink-arg=/nodefaultlib:msvcrt.lib",
"-Clink-arg=msvcrtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprtd.lib" ]
@ -583,16 +576,9 @@ config("dynamic_crt") {
} else {
cflags = [ "/MD" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=-crt-static" ]
} else {
# /MD specifies msvcrt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=msvcrt.lib" ]
}
# /MD specifies msvcrt.lib as the CRT library, which is the dynamic+release
# version. Rust needs to agree, and its default mode is dynamic+release, so
# we do nothing here. See https://github.com/rust-lang/rust/issues/39016.
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:msvcprt.lib" ]
@ -605,12 +591,15 @@ config("static_crt") {
# This pulls in the static debug CRT and defines _DEBUG
cflags = [ "/MTd" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we should
# instead tell rustc which CRT to use (static/dynamic + release/debug). We
# can't support prebuilt stdlib in this path until then.
rustflags = [ "-Clink-arg=libcmtd.lib" ]
# /MTd specifies libcmtd.lib as the CRT library. Rust needs to agree, so we
# specify it explicitly. We tell Rust that we're using the static CRT but
# remove the release library that it chooses, and replace with the debug
# library. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [
"-Ctarget-feature=+crt-static",
"-Clink-arg=/nodefaultlib:libcmt.lib",
"-Clink-arg=libcmtd.lib",
]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmtd.lib" ]
@ -618,16 +607,10 @@ config("static_crt") {
} else {
cflags = [ "/MT" ]
if (rust_prebuilt_stdlib) {
rustflags = [ "-Ctarget-feature=+crt-static" ]
} else {
# /MT specifies libcmt.lib as the CRT library. Rust needs to agree, so
# we specify it explicitly.
# Once https://github.com/rust-lang/rust/issues/39016 is resolved we
# should instead tell rustc which CRT to use (static/dynamic +
# release/debug).
rustflags = [ "-Clink-arg=libcmt.lib" ]
}
# /MT specifies libcmt.lib as the CRT library, which is the static+release
# version. Rust needs to agree, so we tell it to use the static+release CRT
# as well. See https://github.com/rust-lang/rust/issues/39016.
rustflags = [ "-Ctarget-feature=+crt-static" ]
if (use_custom_libcxx) {
ldflags = [ "/DEFAULTLIB:libcpmt.lib" ]
@ -667,7 +650,7 @@ config("default_incremental_linking") {
# lld.
ldflags += [ "/OPT:NOREF" ]
# TODO(crbug.com/1444129): Mixing incremental and icf produces an error
# TODO(crbug.com/40267564): Mixing incremental and icf produces an error
# in lld-link.
ldflags += [ "/OPT:NOICF" ]
}