Commit 1a693093 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

win: Pass /libpath: on Windows too, and use /lldignoreenv to make lld ignore the %LIB% env var.

See https://reviews.llvm.org/D67456

Makes the build a bit more hermetic, and should have no behavior change.

Bug: none
Change-Id: I90080aa7f8ec814e6ec9b1a4fbcad464e12a450d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1807154
Auto-Submit: Nico Weber <thakis@chromium.org>
Commit-Queue: Reid Kleckner <rnk@chromium.org>
Reviewed-by: default avatarReid Kleckner <rnk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697369}
parent ef510737
...@@ -142,6 +142,9 @@ config("compiler") { ...@@ -142,6 +142,9 @@ config("compiler") {
# (link.exe also writes the current time, but it doesn't have a flag to # (link.exe also writes the current time, but it doesn't have a flag to
# override that behavior.) # override that behavior.)
ldflags += [ "/TIMESTAMP:" + build_timestamp ] ldflags += [ "/TIMESTAMP:" + build_timestamp ]
# Don't look for libpaths in %LIB%, similar to /X in cflags above.
ldflags += [ "/lldignoreenv" ]
} }
if (!is_debug && !is_component_build) { if (!is_debug && !is_component_build) {
......
...@@ -130,17 +130,17 @@ template("msvc_toolchain") { ...@@ -130,17 +130,17 @@ template("msvc_toolchain") {
# ninja does not have -t msvc other than windows, and lld doesn't depend on # ninja does not have -t msvc other than windows, and lld doesn't depend on
# mt.exe in PATH on non-Windows, so it's not needed there anyways. # mt.exe in PATH on non-Windows, so it's not needed there anyways.
if (defined(invoker.sys_lib_flags)) { if (host_os != "win") {
linker_wrapper = "" linker_wrapper = ""
sys_lib_flags = "${invoker.sys_lib_flags} " # Note trailing space sys_lib_flags = "${invoker.sys_lib_flags} " # Note trailing space
} else if (use_lld) { } else if (defined(invoker.sys_lib_flags)) {
# Invoke ninja as wrapper instead of tool wrapper, because python # Invoke ninja as wrapper instead of tool wrapper, because python
# invocation requires higher cpu usage compared to ninja invocation, and # invocation requires higher cpu usage compared to ninja invocation, and
# the python wrapper is only needed to work around link.exe problems. # the python wrapper is only needed to work around link.exe problems.
# TODO(thakis): Remove wrapper once lld-link can merge manifests without # TODO(thakis): Remove wrapper once lld-link can merge manifests without
# relying on mt.exe being in %PATH% on Windows, https://crbug.com/872740 # relying on mt.exe being in %PATH% on Windows, https://crbug.com/872740
linker_wrapper = "ninja -t msvc -e $env -- " # Note trailing space. linker_wrapper = "ninja -t msvc -e $env -- " # Note trailing space.
sys_lib_flags = "" sys_lib_flags = "${invoker.sys_lib_flags} " # Note trailing space
} else { } else {
linker_wrapper = linker_wrapper =
"$python_path $tool_wrapper_path link-wrapper $env False " # Note trailing space. "$python_path $tool_wrapper_path link-wrapper $env False " # Note trailing space.
...@@ -359,10 +359,6 @@ template("win_toolchains") { ...@@ -359,10 +359,6 @@ template("win_toolchains") {
msvc_toolchain(target_name) { msvc_toolchain(target_name) {
environment = "environment." + toolchain_arch environment = "environment." + toolchain_arch
cl = "${goma_prefix}\"${win_toolchain_data.vc_bin_dir}/cl.exe\"" cl = "${goma_prefix}\"${win_toolchain_data.vc_bin_dir}/cl.exe\""
if (host_os != "win") {
# For win cross build
sys_lib_flags = "${win_toolchain_data.libpath_flags}"
}
toolchain_args = { toolchain_args = {
if (defined(invoker.toolchain_args)) { if (defined(invoker.toolchain_args)) {
...@@ -383,10 +379,7 @@ template("win_toolchains") { ...@@ -383,10 +379,7 @@ template("win_toolchains") {
cl = string_replace(cl, "/", "\\") cl = string_replace(cl, "/", "\\")
} }
sys_include_flags = "${win_toolchain_data.include_flags_imsvc}" sys_include_flags = "${win_toolchain_data.include_flags_imsvc}"
if (host_os != "win") { sys_lib_flags = "${win_toolchain_data.libpath_flags}"
# For win cross build
sys_lib_flags = "${win_toolchain_data.libpath_flags}"
}
toolchain_args = { toolchain_args = {
if (defined(invoker.toolchain_args)) { if (defined(invoker.toolchain_args)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment