Commit 33d42255 authored by Nico Weber's avatar Nico Weber Committed by Commit Bot

Reland "win: Pass /libpath: on Windows too, and use /lldignoreenv to make lld...

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

This is a reland of 1a693093
The reland completely omits the non-clang toolchains in
cross builds.

Original change's description:
> 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: Reid Kleckner <rnk@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#697369}

Bug: none
Change-Id: I0de1b71b0f2bff753bcbe69da01ea9694e11edf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1810061
Auto-Submit: Nico Weber <thakis@chromium.org>
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: default avatarHans Wennborg <hans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697556}
parent 2472cab6
......@@ -142,6 +142,9 @@ config("compiler") {
# (link.exe also writes the current time, but it doesn't have a flag to
# override that behavior.)
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) {
......
......@@ -130,17 +130,17 @@ template("msvc_toolchain") {
# 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.
if (defined(invoker.sys_lib_flags)) {
if (host_os != "win") {
linker_wrapper = ""
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
# invocation requires higher cpu usage compared to ninja invocation, and
# the python wrapper is only needed to work around link.exe problems.
# TODO(thakis): Remove wrapper once lld-link can merge manifests without
# relying on mt.exe being in %PATH% on Windows, https://crbug.com/872740
linker_wrapper = "ninja -t msvc -e $env -- " # Note trailing space.
sys_lib_flags = ""
sys_lib_flags = "${invoker.sys_lib_flags} " # Note trailing space
} else {
linker_wrapper =
"$python_path $tool_wrapper_path link-wrapper $env False " # Note trailing space.
......@@ -356,21 +356,22 @@ template("win_toolchains") {
],
"scope")
msvc_toolchain(target_name) {
environment = "environment." + toolchain_arch
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}"
}
# The toolchain using MSVC only makes sense when not doing cross builds.
# Chromium exclusively uses the win_clang_ toolchain below, but V8 and
# WebRTC still use this MSVC toolchain in some cases.
if (host_os == "win") {
msvc_toolchain(target_name) {
environment = "environment." + toolchain_arch
cl = "${goma_prefix}\"${win_toolchain_data.vc_bin_dir}/cl.exe\""
toolchain_args = {
if (defined(invoker.toolchain_args)) {
forward_variables_from(invoker.toolchain_args, "*")
toolchain_args = {
if (defined(invoker.toolchain_args)) {
forward_variables_from(invoker.toolchain_args, "*")
}
is_clang = false
current_os = "win"
current_cpu = toolchain_arch
}
is_clang = false
current_os = "win"
current_cpu = toolchain_arch
}
}
......@@ -383,10 +384,7 @@ template("win_toolchains") {
cl = string_replace(cl, "/", "\\")
}
sys_include_flags = "${win_toolchain_data.include_flags_imsvc}"
if (host_os != "win") {
# For win cross build
sys_lib_flags = "${win_toolchain_data.libpath_flags}"
}
sys_lib_flags = "${win_toolchain_data.libpath_flags}"
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