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

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: oops 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
« build/toolchain/lld.gni ('K') | « build/toolchain/lld.gni ('k') | 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/lld.gni")
8 import("//build/toolchain/toolchain.gni") 9 import("//build/toolchain/toolchain.gni")
9 10
10 # Should only be running on Windows. 11 # Should only be running on Windows.
11 assert(is_win) 12 assert(is_win)
12 13
13 # Setup the Visual Studio state. 14 # Setup the Visual Studio state.
14 # 15 #
15 # Its arguments are the VS path and the compiler wrapper tool. It will write 16 # 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 17 # "environment.x86" and "environment.x64" to the build directory and return a
17 # list to us. 18 # list to us.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 # environment: File name of environment file. 51 # environment: File name of environment file.
51 template("msvc_toolchain") { 52 template("msvc_toolchain") {
52 if (defined(invoker.concurrent_links)) { 53 if (defined(invoker.concurrent_links)) {
53 concurrent_links = invoker.concurrent_links 54 concurrent_links = invoker.concurrent_links
54 } 55 }
55 56
56 env = invoker.environment 57 env = invoker.environment
57 58
58 cl = invoker.cl 59 cl = invoker.cl
59 60
61 if (use_lld) {
62 if (host_os == "win") {
63 lld_link = "lld-link.exe"
64 } else {
65 lld_link = "lld-link"
66 }
67 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin",
68 root_build_dir)
69
70 # lld-link includes a replacement for lib.exe that can produce thin
71 # archives and understands bitcode (for lto builds).
72 lib = "$prefix/$lld_link /lib /llvmlibthin"
73 link = "$prefix/$lld_link"
74 } else {
75 lib = "lib.exe"
76 link = "link.exe"
77 }
78
60 toolchain(target_name) { 79 toolchain(target_name) {
61 # Make these apply to all tools below. 80 # Make these apply to all tools below.
62 lib_switch = "" 81 lib_switch = ""
63 lib_dir_switch = "/LIBPATH:" 82 lib_dir_switch = "/LIBPATH:"
64 83
65 # Object files go in this directory. 84 # Object files go in this directory.
66 object_subdir = "{{target_out_dir}}/{{label_name}}" 85 object_subdir = "{{target_out_dir}}/{{label_name}}"
67 86
68 tool("cc") { 87 tool("cc") {
69 rspfile = "{{output}}.rsp" 88 rspfile = "{{output}}.rsp"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 134 }
116 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}" 135 command = "$python_path gyp-win-tool asm-wrapper $env $ml {{defines}} {{in clude_dirs}} {{asmflags}} /c /Fo{{output}} {{source}}"
117 description = "ASM {{output}}" 136 description = "ASM {{output}}"
118 outputs = [ 137 outputs = [
119 "$object_subdir/{{source_name_part}}.obj", 138 "$object_subdir/{{source_name_part}}.obj",
120 ] 139 ]
121 } 140 }
122 141
123 tool("alink") { 142 tool("alink") {
124 rspfile = "{{output}}.rsp" 143 rspfile = "{{output}}.rsp"
125 command = "$python_path gyp-win-tool link-wrapper $env False lib.exe /nolo go /ignore:4221 /OUT:{{output}} @$rspfile" 144 command = "$python_path gyp-win-tool link-wrapper $env False $lib /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
126 description = "LIB {{output}}" 145 description = "LIB {{output}}"
127 outputs = [ 146 outputs = [
128 # Ignore {{output_extension}} and always use .lib, there's no reason to 147 # Ignore {{output_extension}} and always use .lib, there's no reason to
129 # allow targets to override this extension on Windows. 148 # allow targets to override this extension on Windows.
130 "{{target_out_dir}}/{{target_output_name}}.lib", 149 "{{target_out_dir}}/{{target_output_name}}.lib",
131 ] 150 ]
132 default_output_extension = ".lib" 151 default_output_extension = ".lib"
133 152
134 # The use of inputs_newline is to work around a fixed per-line buffer 153 # The use of inputs_newline is to work around a fixed per-line buffer
135 # size in the linker. 154 # size in the linker.
136 rspfile_content = "{{inputs_newline}}" 155 rspfile_content = "{{inputs_newline}}"
137 } 156 }
138 157
139 tool("solink") { 158 tool("solink") {
140 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll 159 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll
141 libname = "${dllname}.lib" # e.g. foo.dll.lib 160 libname = "${dllname}.lib" # e.g. foo.dll.lib
142 rspfile = "${dllname}.rsp" 161 rspfile = "${dllname}.rsp"
143 162
144 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" 163 link_command = "$python_path gyp-win-tool link-wrapper $env False $link /n ologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
145 164
146 # TODO(brettw) support manifests 165 # TODO(brettw) support manifests
147 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:${dllname}.manifest" 166 #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" 167 #command = "cmd /c $link_command && $manifest_command"
149 command = link_command 168 command = link_command
150 169
151 default_output_extension = ".dll" 170 default_output_extension = ".dll"
152 description = "LINK(DLL) {{output}}" 171 description = "LINK(DLL) {{output}}"
153 outputs = [ 172 outputs = [
154 dllname, 173 dllname,
(...skipping 10 matching lines...) Expand all
165 184
166 # The use of inputs_newline is to work around a fixed per-line buffer 185 # The use of inputs_newline is to work around a fixed per-line buffer
167 # size in the linker. 186 # size in the linker.
168 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" 187 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
169 } 188 }
170 189
171 tool("solink_module") { 190 tool("solink_module") {
172 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll 191 dllname = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e.g. foo.dll
173 rspfile = "${dllname}.rsp" 192 rspfile = "${dllname}.rsp"
174 193
175 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile" 194 link_command = "$python_path gyp-win-tool link-wrapper $env False $link /n ologo /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
176 195
177 command = link_command 196 command = link_command
178 197
179 default_output_extension = ".dll" 198 default_output_extension = ".dll"
180 description = "LINK_MODULE(DLL) {{output}}" 199 description = "LINK_MODULE(DLL) {{output}}"
181 outputs = [ 200 outputs = [
182 dllname, 201 dllname,
183 ] 202 ]
184 203
185 # The use of inputs_newline is to work around a fixed per-line buffer 204 # The use of inputs_newline is to work around a fixed per-line buffer
186 # size in the linker. 205 # size in the linker.
187 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}" 206 rspfile_content = "{{libs}} {{solibs}} {{inputs_newline}} {{ldflags}}"
188 } 207 }
189 208
190 tool("link") { 209 tool("link") {
191 rspfile = "{{output}}.rsp" 210 rspfile = "{{output}}.rsp"
192 211
193 link_command = "$python_path gyp-win-tool link-wrapper $env False link.exe /nologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile" 212 link_command = "$python_path gyp-win-tool link-wrapper $env False $link /n ologo /OUT:{{output}} /PDB:{{output}}.pdb @$rspfile"
194 213
195 # TODO(brettw) support manifests 214 # TODO(brettw) support manifests
196 #manifest_command = "$python_path gyp-win-tool manifest-wrapper $env mt.ex e -nologo -manifest $manifests -out:{{output}}.manifest" 215 #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" 216 #command = "cmd /c $link_command && $manifest_command"
198 command = link_command 217 command = link_command
199 218
200 default_output_extension = ".exe" 219 default_output_extension = ".exe"
201 description = "LINK {{output}}" 220 description = "LINK {{output}}"
202 outputs = [ 221 outputs = [
203 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}", 222 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}",
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 380
362 msvc_toolchain("winrt_x64") { 381 msvc_toolchain("winrt_x64") {
363 environment = "environment.winrt_x64" 382 environment = "environment.winrt_x64"
364 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\"" 383 cl = "${goma_prefix}\"${vc_bin_dir}/cl.exe\""
365 is_clang = false 384 is_clang = false
366 385
367 toolchain_cpu = "x64" 386 toolchain_cpu = "x64"
368 toolchain_os = current_os 387 toolchain_os = current_os
369 } 388 }
370 } 389 }
OLDNEW
« build/toolchain/lld.gni ('K') | « build/toolchain/lld.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698