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/sanitizers/sanitizers.gni") | 5 import("//build/config/sanitizers/sanitizers.gni") |
6 import("//build/toolchain/toolchain.gni") | 6 import("//build/toolchain/toolchain.gni") |
7 | 7 |
8 # This value will be inherited in the toolchain below. | 8 # This value will be inherited in the toolchain below. |
9 concurrent_links = exec_script("get_concurrent_links.py", [], "value") | 9 concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
10 | 10 |
11 # This template defines a toolchain for something that works like gcc | 11 # This template defines a toolchain for something that works like gcc |
12 # (including clang). | 12 # (including clang). |
13 # | 13 # |
14 # It requires the following variables specifying the executables to run: | 14 # It requires the following variables specifying the executables to run: |
15 # - cc | 15 # - cc |
16 # - cxx | 16 # - cxx |
17 # - ar | 17 # - ar |
18 # - ld | 18 # - ld |
19 # and the following which is used in the toolchain_args | 19 # and the following which is used in the toolchain_args |
20 # - toolchain_cpu (What "current_cpu" should be set to when invoking a | 20 # - toolchain_cpu (What "current_cpu" should be set to when invoking a |
21 # build using this toolchain.) | 21 # build using this toolchain.) |
22 # - toolchain_os (What "current_os" should be set to when invoking a | 22 # - toolchain_os (What "current_os" should be set to when invoking a |
23 # build using this toolchain.) | 23 # build using this toolchain.) |
24 # | 24 # |
25 # Optional parameters: | 25 # Optional parameters that control the tools: |
| 26 # |
26 # - libs_section_prefix | 27 # - libs_section_prefix |
27 # - libs_section_postfix | 28 # - libs_section_postfix |
28 # The contents of these strings, if specified, will be placed around | 29 # The contents of these strings, if specified, will be placed around |
29 # the libs section of the linker line. It allows one to inject libraries | 30 # the libs section of the linker line. It allows one to inject libraries |
30 # at the beginning and end for all targets in a toolchain. | 31 # at the beginning and end for all targets in a toolchain. |
31 # - solink_libs_section_prefix | 32 # - solink_libs_section_prefix |
32 # - solink_libs_section_postfix | 33 # - solink_libs_section_postfix |
33 # Same as libs_section_{pre,post}fix except used for solink instead of link
. | 34 # Same as libs_section_{pre,post}fix except used for solink instead of link
. |
34 # - link_outputs | 35 # - link_outputs |
35 # The content of this array, if specified, will be added to the list of | 36 # The content of this array, if specified, will be added to the list of |
36 # outputs from the link command. This can be useful in conjunction with | 37 # outputs from the link command. This can be useful in conjunction with |
37 # the post_link parameter. | 38 # the post_link parameter. |
38 # - post_link | 39 # - post_link |
39 # The content of this string, if specified, will be run as a separate | 40 # The content of this string, if specified, will be run as a separate |
40 # command following the the link command. | 41 # command following the the link command. |
41 # - deps | 42 # - deps |
42 # Just forwarded to the toolchain definition. | 43 # Just forwarded to the toolchain definition. |
43 # - executable_extension | 44 # - executable_extension |
44 # If this string is specified it will be used for the file extension | 45 # If this string is specified it will be used for the file extension |
45 # for an executable, rather than using no extension; targets will | 46 # for an executable, rather than using no extension; targets will |
46 # still be able to override the extension using the output_extension | 47 # still be able to override the extension using the output_extension |
47 # variable. | 48 # variable. |
48 # - is_clang | |
49 # Whether to use clang instead of gcc. | |
50 # - is_component_build | |
51 # Whether to forcibly enable or disable component builds for this | |
52 # toolchain; if not specified, the toolchain will inherit the | |
53 # default setting. | |
54 # - rebuild_define | 49 # - rebuild_define |
55 # The contents of this string, if specified, will be passed as a #define | 50 # The contents of this string, if specified, will be passed as a #define |
56 # to the toolchain. It can be used to force recompiles whenever a | 51 # to the toolchain. It can be used to force recompiles whenever a |
57 # toolchain is updated. | 52 # toolchain is updated. |
58 # - shlib_extension | 53 # - shlib_extension |
59 # If this string is specified it will be used for the file extension | 54 # If this string is specified it will be used for the file extension |
60 # for a shared library, rather than default value specified in | 55 # for a shared library, rather than default value specified in |
61 # toolchain.gni | 56 # toolchain.gni |
62 # - strip | 57 # - strip |
63 # Location of the strip executable. When specified, strip will be run on | 58 # Location of the strip executable. When specified, strip will be run on |
64 # all shared libraries and executables as they are built. The pre-stripped | 59 # all shared libraries and executables as they are built. The pre-stripped |
65 # artifacts will be put in lib.stripped/ and exe.stripped/. | 60 # artifacts will be put in lib.stripped/ and exe.stripped/. |
| 61 # |
| 62 # Optional build argument contols. |
| 63 # |
| 64 # - clear_sanitizers |
| 65 # When set to true, is_asan, is_msan, etc.will all be set to false. Often |
| 66 # secondary toolchains do not want to run with sanitizers. |
| 67 # - is_clang |
| 68 # Whether to use clang instead of gcc. |
| 69 # - is_component_build |
| 70 # Whether to forcibly enable or disable component builds for this |
| 71 # toolchain; if not specified, the toolchain will inherit the |
| 72 # default setting. |
66 template("gcc_toolchain") { | 73 template("gcc_toolchain") { |
67 toolchain(target_name) { | 74 toolchain(target_name) { |
68 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 75 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
69 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 76 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
70 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 77 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
71 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 78 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
72 assert(defined(invoker.toolchain_cpu), | 79 assert(defined(invoker.toolchain_cpu), |
73 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 80 "gcc_toolchain() must specify a \"toolchain_cpu\"") |
74 assert(defined(invoker.toolchain_os), | 81 assert(defined(invoker.toolchain_os), |
75 "gcc_toolchain() must specify a \"toolchain_os\"") | 82 "gcc_toolchain() must specify a \"toolchain_os\"") |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 # When invoking this toolchain not as the default one, these args will be | 309 # When invoking this toolchain not as the default one, these args will be |
303 # passed to the build. They are ignored when this is the default toolchain. | 310 # passed to the build. They are ignored when this is the default toolchain. |
304 toolchain_args() { | 311 toolchain_args() { |
305 current_cpu = invoker.toolchain_cpu | 312 current_cpu = invoker.toolchain_cpu |
306 current_os = invoker.toolchain_os | 313 current_os = invoker.toolchain_os |
307 | 314 |
308 # These values need to be passed through unchanged. | 315 # These values need to be passed through unchanged. |
309 target_os = target_os | 316 target_os = target_os |
310 target_cpu = target_cpu | 317 target_cpu = target_cpu |
311 | 318 |
312 if (defined(invoker.is_clang)) { | 319 forward_variables_from(invoker, |
313 is_clang = invoker.is_clang | 320 [ |
314 } | 321 "is_clang", |
315 if (defined(invoker.is_component_build)) { | 322 "is_component_build", |
316 is_component_build = invoker.is_component_build | 323 ]) |
| 324 |
| 325 if (defined(invoker.clear_sanitizers) && invoker.clear_sanitizers) { |
| 326 is_asan = false |
| 327 is_cfi = false |
| 328 is_lsan = false |
| 329 is_msan = false |
| 330 is_syzyasan = false |
| 331 is_tsan = false |
317 } | 332 } |
318 } | 333 } |
319 | 334 |
320 if (defined(invoker.deps)) { | 335 forward_variables_from(invoker, [ "deps" ]) |
321 deps = invoker.deps | |
322 } | |
323 } | 336 } |
324 } | 337 } |
OLD | NEW |