OLD | NEW |
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/nacl/config.gni") | 5 import("//build/config/nacl/config.gni") |
6 import("//build/toolchain/ccache.gni") | 6 import("//build/toolchain/ccache.gni") |
7 import("//build/toolchain/goma.gni") | 7 import("//build/toolchain/goma.gni") |
8 | 8 |
9 # This value will be inherited in the toolchain below. | 9 # This value will be inherited in the toolchain below. |
10 concurrent_links = exec_script("get_concurrent_links.py", [], "value") | 10 concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 # Optional build argument contols. | 42 # Optional build argument contols. |
43 # | 43 # |
44 # - is_clang | 44 # - is_clang |
45 # Whether to use clang instead of gcc. | 45 # Whether to use clang instead of gcc. |
46 # - is_component_build | 46 # - is_component_build |
47 # Whether to forcibly enable or disable component builds for this | 47 # Whether to forcibly enable or disable component builds for this |
48 # toolchain; if not specified, the toolchain will inherit the | 48 # toolchain; if not specified, the toolchain will inherit the |
49 # default setting. | 49 # default setting. |
50 # - is_nacl_glibc | 50 # - is_nacl_glibc |
51 # Whether NaCl code is built using Glibc instead of Newlib. | 51 # Whether NaCl code is built using Glibc instead of Newlib. |
| 52 # - use_ccache |
| 53 # Override the global use_ccache setting, useful to opt-out of ccache in |
| 54 # a particular toolchain by setting use_ccache = false in it. |
| 55 # - use_goma |
| 56 # Override the global use_goma setting, useful to opt-out of goma in a |
| 57 # particular toolchain by setting use_gome = false in it. |
| 58 # - use_gold |
| 59 # Override the global use_gold setting, useful if the particular |
| 60 # toolchain has a custom link step that is not actually using Gold. |
52 template("gcc_toolchain") { | 61 template("gcc_toolchain") { |
53 toolchain(target_name) { | 62 toolchain(target_name) { |
54 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 63 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
55 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 64 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
56 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 65 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
57 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 66 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
58 assert(defined(invoker.toolchain_cpu), | 67 assert(defined(invoker.toolchain_cpu), |
59 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 68 "gcc_toolchain() must specify a \"toolchain_cpu\"") |
60 assert(defined(invoker.toolchain_os), | 69 assert(defined(invoker.toolchain_os), |
61 "gcc_toolchain() must specify a \"toolchain_os\"") | 70 "gcc_toolchain() must specify a \"toolchain_os\"") |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 depsformat = "gcc" | 161 depsformat = "gcc" |
153 description = "CXX {{output}}" | 162 description = "CXX {{output}}" |
154 outputs = [ | 163 outputs = [ |
155 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 164 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
156 ] | 165 ] |
157 } | 166 } |
158 | 167 |
159 tool("asm") { | 168 tool("asm") { |
160 # For GCC we can just use the C compiler to compile assembly. | 169 # For GCC we can just use the C compiler to compile assembly. |
161 depfile = "{{output}}.d" | 170 depfile = "{{output}}.d" |
162 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di
rs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}" | 171 command = "$cc -MMD -MF $depfile ${rebuild_string}{{defines}} {{include_di
rs}} {{asmflags}} -c {{source}} -o {{output}}" |
163 depsformat = "gcc" | 172 depsformat = "gcc" |
164 description = "ASM {{output}}" | 173 description = "ASM {{output}}" |
165 outputs = [ | 174 outputs = [ |
166 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", | 175 "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o", |
167 ] | 176 ] |
168 } | 177 } |
169 | 178 |
170 tool("alink") { | 179 tool("alink") { |
171 rspfile = "{{output}}.rsp" | 180 rspfile = "{{output}}.rsp" |
172 command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile" | 181 command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 275 |
267 # These values need to be passed through unchanged. | 276 # These values need to be passed through unchanged. |
268 target_os = target_os | 277 target_os = target_os |
269 target_cpu = target_cpu | 278 target_cpu = target_cpu |
270 | 279 |
271 forward_variables_from(invoker, | 280 forward_variables_from(invoker, |
272 [ | 281 [ |
273 "is_clang", | 282 "is_clang", |
274 "is_component_build", | 283 "is_component_build", |
275 "is_nacl_glibc", | 284 "is_nacl_glibc", |
| 285 "use_gold", |
| 286 "symbol_level", |
276 ]) | 287 ]) |
277 } | 288 } |
278 | 289 |
279 forward_variables_from(invoker, [ "deps" ]) | 290 forward_variables_from(invoker, [ "deps" ]) |
280 } | 291 } |
281 } | 292 } |
| 293 |
| 294 # This is a shorthand for gcc_toolchain instances based on the |
| 295 # Chromium-built version of Clang. Only the toolchain_cpu and |
| 296 # toolchain_os variables need to be specified by the invoker, and |
| 297 # optionally toolprefix if it's a cross-compile case. Note that for |
| 298 # a cross-compile case this toolchain requires a config to pass the |
| 299 # appropriate -target option, or else it will actually just be doing |
| 300 # a native compile. The invoker can optionally override use_gold too. |
| 301 template("clang_toolchain") { |
| 302 assert(defined(invoker.toolchain_cpu), |
| 303 "clang_toolchain() must specify a \"toolchain_cpu\"") |
| 304 assert(defined(invoker.toolchain_os), |
| 305 "clang_toolchain() must specify a \"toolchain_os\"") |
| 306 if (defined(invoker.toolprefix)) { |
| 307 toolprefix = invoker.toolprefix |
| 308 } else { |
| 309 toolprefix = "" |
| 310 } |
| 311 |
| 312 gcc_toolchain(target_name) { |
| 313 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
| 314 root_build_dir) |
| 315 cc = "$prefix/clang" |
| 316 cxx = "$prefix/clang++" |
| 317 ld = cxx |
| 318 is_clang = true |
| 319 |
| 320 readelf = "${toolprefix}readelf" |
| 321 ar = "${toolprefix}ar" |
| 322 nm = "${toolprefix}nm" |
| 323 |
| 324 forward_variables_from(invoker, |
| 325 [ |
| 326 "toolchain_cpu", |
| 327 "toolchain_os", |
| 328 "use_gold", |
| 329 ]) |
| 330 } |
| 331 } |
OLD | NEW |