Index: build/toolchain/win/BUILD.gn |
diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn |
index b0c5e279dac71041f310d98b6d6f89a7c169c379..71c5e4843092fa9732321964e99cafce9c447c4e 100644 |
--- a/build/toolchain/win/BUILD.gn |
+++ b/build/toolchain/win/BUILD.gn |
@@ -5,6 +5,7 @@ |
import("//build/config/sanitizers/sanitizers.gni") |
import("//build/config/win/visual_studio_version.gni") |
import("//build/toolchain/goma.gni") |
+import("//build/toolchain/lld.gni") |
import("//build/toolchain/toolchain.gni") |
# Should only be running on Windows. |
@@ -57,6 +58,24 @@ template("msvc_toolchain") { |
cl = invoker.cl |
+ if (use_lld) { |
+ if (host_os == "win") { |
+ lld_link = "lld-link.exe" |
+ } else { |
+ lld_link = "lld-link" |
+ } |
+ prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
+ root_build_dir) |
+ |
+ # lld-link includes a replacement for lib.exe that can produce thin |
+ # archives and understands bitcode (for lto builds). |
+ lib = "$prefix/$lld_link /lib /llvmlibthin" |
+ link = "$prefix/$lld_link" |
+ } else { |
+ lib = "lib.exe" |
+ link = "link.exe" |
+ } |
+ |
toolchain(target_name) { |
# Make these apply to all tools below. |
lib_switch = "" |
@@ -122,7 +141,7 @@ template("msvc_toolchain") { |
tool("alink") { |
rspfile = "{{output}}.rsp" |
- command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nologo /ignore:4221 /OUT:{{output}} @$rspfile" |
+ command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo /ignore:4221 /OUT:{{output}} @$rspfile" |
description = "LIB {{output}}" |
outputs = [ |
# Ignore {{output_extension}} and always use .lib, there's no reason to |
@@ -141,7 +160,7 @@ template("msvc_toolchain") { |
libname = "${dllname}.lib" # e.g. foo.dll.lib |
rspfile = "${dllname}.rsp" |
- link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" |
+ link_command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" |
# TODO(brettw) support manifests |
#manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:${dllname}.manifest" |
@@ -172,7 +191,7 @@ template("msvc_toolchain") { |
dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll |
rspfile = "${dllname}.rsp" |
- link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" |
+ link_command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" |
command = link_command |
@@ -190,7 +209,7 @@ template("msvc_toolchain") { |
tool("link") { |
rspfile = "{{output}}.rsp" |
- link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile" |
+ link_command = "$python_path gyp-win-tool link-wrapper $env False $link /nologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile" |
# TODO(brettw) support manifests |
#manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:{{output}}.manifest" |