Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: build/toolchain/win/BUILD.gn

Issue 1880873004: Port use_lld flag from gyp to gn. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/sanitizers/sanitizers.gni") 5 import("//build/config/sanitizers/sanitizers.gni")
6 import("//build/config/win/visual_studio_version.gni") 6 import("//build/config/win/visual_studio_version.gni")
7 import("//build/toolchain/goma.gni") 7 import("//build/toolchain/goma.gni")
8 import("//build/toolchain/toolchain.gni") 8 import("//build/toolchain/toolchain.gni")
9 9
10 # Should only be running on Windows. 10 # Should only be running on Windows.
11 assert(is_win) 11 assert(is_win)
12 12
13 declare_args() {
14 # Set to true to use lld, the LLVM linker.
15 use_lld = false
16 }
17
13 # Setup the Visual Studio state. 18 # Setup the Visual Studio state.
14 # 19 #
15 # Its arguments are the VS path and the compiler wrapper tool. It will write 20 # Its arguments are the VS path and the compiler wrapper tool. It will write
16 # "environment.x86" and "environment.x64" to the build directory and return a 21 # "environment.x86" and "environment.x64" to the build directory and return a
17 # list to us. 22 # list to us.
18 gyp_win_tool_path = 23 gyp_win_tool_path =
19 rebase_path("//tools/gyp/pylib/gyp/win_tool.py", root_build_dir) 24 rebase_path("//tools/gyp/pylib/gyp/win_tool.py", root_build_dir)
20 25
21 if (use_goma) { 26 if (use_goma) {
22 goma_prefix = "$goma_dir/gomacc.exe " 27 goma_prefix = "$goma_dir/gomacc.exe "
(...skipping 27 matching lines...) Expand all
50 # environment: File name of environment file. 55 # environment: File name of environment file.
51 template("msvc_toolchain") { 56 template("msvc_toolchain") {
52 if (defined(invoker.concurrent_links)) { 57 if (defined(invoker.concurrent_links)) {
53 concurrent_links = invoker.concurrent_links 58 concurrent_links = invoker.concurrent_links
54 } 59 }
55 60
56 env = invoker.environment 61 env = invoker.environment
57 62
58 cl = invoker.cl 63 cl = invoker.cl
59 64
65 if (use_lld) {
66 if (host_os == "win") {
67 lld_link = "lld-link.exe"
68 } else {
69 lld_link = "lld-link"
70 }
71 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
72 root_build_dir)
73
74 # lld-link includes a replacement for lib.exe that can produce thin
75 # archives and understands bitcode (for lto builds).
76 lib = "$prefix/$lld_link /lib /llvmlibthin"
77 link = "$prefix/$lld_link"
78 } else {
79 lib = "lib.exe"
80 link = "link.exe"
81 }
82
60 toolchain(target_name) { 83 toolchain(target_name) {
61 # Make these apply to all tools below. 84 # Make these apply to all tools below.
62 lib_switch = "" 85 lib_switch = ""
63 lib_dir_switch = "/LIBPATH:" 86 lib_dir_switch = "/LIBPATH:"
64 87
65 # Object files go in this directory. 88 # Object files go in this directory.
66 object_subdir = "{{target_out_dir}}/{{label_name}}" 89 object_subdir = "{{target_out_dir}}/{{label_name}}"
67 90
68 tool("cc") { 91 tool("cc") {
69 rspfile = "{{output}}.rsp" 92 rspfile = "{{output}}.rsp"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 138 }
116 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" 139 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}"
117 description = "ASM {{output}}" 140 description = "ASM {{output}}"
118 outputs = [ 141 outputs = [
119 "$object_subdir/{{source_name_part}}.obj", 142 "$object_subdir/{{source_name_part}}.obj",
120 ] 143 ]
121 } 144 }
122 145
123 tool("alink") { 146 tool("alink") {
124 rspfile = "{{output}}.rsp" 147 rspfile = "{{output}}.rsp"
125 command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nolo go /ignore:4221 /OUT:{{output}} @$rspfile" 148 command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
126 description = "LIB {{output}}" 149 description = "LIB {{output}}"
127 outputs = [ 150 outputs = [
128 # Ignore {{output_extension}} and always use .lib, there's no reason to 151 # Ignore {{output_extension}} and always use .lib, there's no reason to
129 # allow targets to override this extension on Windows. 152 # allow targets to override this extension on Windows.
130 "{{target_out_dir}}/{{target_output_name}}.lib", 153 "{{target_out_dir}}/{{target_output_name}}.lib",
131 ] 154 ]
132 default_output_extension = ".lib" 155 default_output_extension = ".lib"
133 156
134 # The use of inputs_newline is to work around a fixed per-line buffer 157 # The use of inputs_newline is to work around a fixed per-line buffer
135 # size in the linker. 158 # size in the linker.
136 rspfile_content = "{{inputs_newline}}" 159 rspfile_content = "{{inputs_newline}}"
137 } 160 }
138 161
139 tool("solink") { 162 tool("solink") {
140 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll 163 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll
141 libname = "${dllname}.lib" # e.g. foo.dll.lib 164 libname = "${dllname}.lib" # e.g. foo.dll.lib
142 rspfile = "${dllname}.rsp" 165 rspfile = "${dllname}.rsp"
143 166
144 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" 167 link_command = "$python_path gyp-win-tool link-wrapper $env False $link /n ologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
145 168
146 # TODO(brettw) support manifests 169 # TODO(brettw) support manifests
147 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:${dllname}.manifest" 170 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:${dllname}.manifest"
148 #command = "cmd /c $link_command && $manifest_command" 171 #command = "cmd /c $link_command && $manifest_command"
149 command = link_command 172 command = link_command
150 173
151 default_output_extension = ".dll" 174 default_output_extension = ".dll"
152 description = "LINK(DLL) {{output}}" 175 description = "LINK(DLL) {{output}}"
153 outputs = [ 176 outputs = [
154 dllname, 177 dllname,
(...skipping 10 matching lines...) Expand all
165 188
166 # The use of inputs_newline is to work around a fixed per-line buffer 189 # The use of inputs_newline is to work around a fixed per-line buffer
167 # size in the linker. 190 # size in the linker.
168 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" 191 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
169 } 192 }
170 193
171 tool("solink_module") { 194 tool("solink_module") {
172 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll 195 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll
173 rspfile = "${dllname}.rsp" 196 rspfile = "${dllname}.rsp"
174 197
175 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" 198 link_command = "$python_path gyp-win-tool link-wrapper $env False $link /n ologo /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
176 199
177 command = link_command 200 command = link_command
178 201
179 default_output_extension = ".dll" 202 default_output_extension = ".dll"
180 description = "LINK_MODULE(DLL) {{output}}" 203 description = "LINK_MODULE(DLL) {{output}}"
181 outputs = [ 204 outputs = [
182 dllname, 205 dllname,
183 ] 206 ]
184 207
185 # The use of inputs_newline is to work around a fixed per-line buffer 208 # The use of inputs_newline is to work around a fixed per-line buffer
186 # size in the linker. 209 # size in the linker.
187 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" 210 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
188 } 211 }
189 212
190 tool("link") { 213 tool("link") {
191 rspfile = "{{output}}.rsp" 214 rspfile = "{{output}}.rsp"
192 215
193 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile" 216 link_command = "$python_path gyp-win-tool link-wrapper $env False $link /n ologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile"
194 217
195 # TODO(brettw) support manifests 218 # TODO(brettw) support manifests
196 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:{{output}}.manifest" 219 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:{{output}}.manifest"
197 #command = "cmd /c $link_command && $manifest_command" 220 #command = "cmd /c $link_command && $manifest_command"
198 command = link_command 221 command = link_command
199 222
200 default_output_extension = ".exe" 223 default_output_extension = ".exe"
201 description = "LINK {{output}}" 224 description = "LINK {{output}}"
202 outputs = [ 225 outputs = [
203 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", 226 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 384
362 msvc_toolchain("winrt_x64") { 385 msvc_toolchain("winrt_x64") {
363 environment = "environment.winrt_x64" 386 environment = "environment.winrt_x64"
364 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" 387 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
365 is_clang = false 388 is_clang = false
366 389
367 toolchain_cpu = "x64" 390 toolchain_cpu = "x64"
368 toolchain_os = current_os 391 toolchain_os = current_os
369 } 392 }
370 } 393 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698