| 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/config/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
| 7 import("//build/toolchain/ccache.gni") | 7 import("//build/toolchain/cc_wrapper.gni") |
| 8 import("//build/toolchain/goma.gni") | 8 import("//build/toolchain/goma.gni") |
| 9 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
| 10 | 10 |
| 11 # This value will be inherited in the toolchain below. | 11 # This value will be inherited in the toolchain below. |
| 12 if (is_cfi) { | 12 if (is_cfi) { |
| 13 concurrent_links = | 13 concurrent_links = |
| 14 exec_script("get_concurrent_links.py", [ "--lto" ], "value") | 14 exec_script("get_concurrent_links.py", [ "--lto" ], "value") |
| 15 } else { | 15 } else { |
| 16 concurrent_links = exec_script("get_concurrent_links.py", [], "value") | 16 concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
| 17 } | 17 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 # When set to true, is_asan, is_msan, etc.will all be set to false. Often | 73 # When set to true, is_asan, is_msan, etc.will all be set to false. Often |
| 74 # secondary toolchains do not want to run with sanitizers. | 74 # secondary toolchains do not want to run with sanitizers. |
| 75 # - is_clang | 75 # - is_clang |
| 76 # Whether to use clang instead of gcc. | 76 # Whether to use clang instead of gcc. |
| 77 # - is_component_build | 77 # - is_component_build |
| 78 # Whether to forcibly enable or disable component builds for this | 78 # Whether to forcibly enable or disable component builds for this |
| 79 # toolchain; if not specified, the toolchain will inherit the | 79 # toolchain; if not specified, the toolchain will inherit the |
| 80 # default setting. | 80 # default setting. |
| 81 # - is_nacl_glibc | 81 # - is_nacl_glibc |
| 82 # Whether NaCl code is built using Glibc instead of Newlib. | 82 # Whether NaCl code is built using Glibc instead of Newlib. |
| 83 # - use_ccache | 83 # - cc_wrapper |
| 84 # Override the global use_ccache setting, useful to opt-out of ccache in | 84 # Override the global cc_wrapper setting. e.g. "ccache" or "icecc". |
| 85 # a particular toolchain by setting use_ccache = false in it. | 85 # useful to opt-out of cc_wrapper in a particular toolchain by setting |
| 86 # cc_wrapper = "" in it. |
| 86 # - use_goma | 87 # - use_goma |
| 87 # Override the global use_goma setting, useful to opt-out of goma in a | 88 # Override the global use_goma setting, useful to opt-out of goma in a |
| 88 # particular toolchain by setting use_gome = false in it. | 89 # particular toolchain by setting use_gome = false in it. |
| 89 # - use_gold | 90 # - use_gold |
| 90 # Override the global use_gold setting, useful if the particular | 91 # Override the global use_gold setting, useful if the particular |
| 91 # toolchain has a custom link step that is not actually using Gold. | 92 # toolchain has a custom link step that is not actually using Gold. |
| 92 template("gcc_toolchain") { | 93 template("gcc_toolchain") { |
| 93 toolchain(target_name) { | 94 toolchain(target_name) { |
| 94 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 95 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
| 95 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 96 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
| 96 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 97 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
| 97 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 98 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
| 98 assert(defined(invoker.toolchain_cpu), | 99 assert(defined(invoker.toolchain_cpu), |
| 99 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 100 "gcc_toolchain() must specify a \"toolchain_cpu\"") |
| 100 assert(defined(invoker.toolchain_os), | 101 assert(defined(invoker.toolchain_os), |
| 101 "gcc_toolchain() must specify a \"toolchain_os\"") | 102 "gcc_toolchain() must specify a \"toolchain_os\"") |
| 102 | 103 |
| 103 if (defined(invoker.use_ccache)) { | 104 if (defined(invoker.cc_wrapper)) { |
| 104 use_ccache = invoker.use_ccache | 105 cc_wrapper = invoker.cc_wrapper |
| 105 } | 106 } |
| 106 if (defined(invoker.use_goma)) { | 107 if (defined(invoker.use_goma)) { |
| 107 use_goma = invoker.use_goma | 108 use_goma = invoker.use_goma |
| 108 } | 109 } |
| 109 if (use_goma) { | 110 if (use_goma) { |
| 110 assert(!use_ccache, "Goma and ccache can't be used together.") | 111 assert(cc_wrapper == "", "Goma and cc_wrapper can't be used together.") |
| 111 compiler_prefix = "$goma_dir/gomacc " | 112 compiler_prefix = "$goma_dir/gomacc " |
| 112 } else if (use_ccache) { | 113 } else if (cc_wrapper != "") { |
| 113 compiler_prefix = "ccache " | 114 compiler_prefix = cc_wrapper + " " |
| 114 } else { | 115 } else { |
| 115 compiler_prefix = "" | 116 compiler_prefix = "" |
| 116 } | 117 } |
| 117 | 118 |
| 118 # This define changes when the toolchain changes, forcing a rebuild. | 119 # This define changes when the toolchain changes, forcing a rebuild. |
| 119 # Nothing should ever use this define. | 120 # Nothing should ever use this define. |
| 120 if (defined(invoker.rebuild_define)) { | 121 if (defined(invoker.rebuild_define)) { |
| 121 rebuild_string = "-D" + invoker.rebuild_define + " " | 122 rebuild_string = "-D" + invoker.rebuild_define + " " |
| 122 } else { | 123 } else { |
| 123 rebuild_string = "" | 124 rebuild_string = "" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 is_tsan = false | 419 is_tsan = false |
| 419 is_ubsan = false | 420 is_ubsan = false |
| 420 is_ubsan_vptr = false | 421 is_ubsan_vptr = false |
| 421 } | 422 } |
| 422 } | 423 } |
| 423 | 424 |
| 424 forward_variables_from(invoker, [ "deps" ]) | 425 forward_variables_from(invoker, [ "deps" ]) |
| 425 } | 426 } |
| 426 } | 427 } |
| 427 | 428 |
| 428 declare_args() { | |
| 429 clang_dir = "//third_party/llvm-build/Release+Asserts" | |
| 430 } | |
| 431 | |
| 432 # This is a shorthand for gcc_toolchain instances based on the | 429 # This is a shorthand for gcc_toolchain instances based on the |
| 433 # Chromium-built version of Clang. Only the toolchain_cpu and | 430 # Chromium-built version of Clang. Only the toolchain_cpu and |
| 434 # toolchain_os variables need to be specified by the invoker, and | 431 # toolchain_os variables need to be specified by the invoker, and |
| 435 # optionally toolprefix if it's a cross-compile case. Note that for | 432 # optionally toolprefix if it's a cross-compile case. Note that for |
| 436 # a cross-compile case this toolchain requires a config to pass the | 433 # a cross-compile case this toolchain requires a config to pass the |
| 437 # appropriate -target option, or else it will actually just be doing | 434 # appropriate -target option, or else it will actually just be doing |
| 438 # a native compile. The invoker can optionally override use_gold too. | 435 # a native compile. The invoker can optionally override use_gold too. |
| 439 template("clang_toolchain") { | 436 template("clang_toolchain") { |
| 440 assert(defined(invoker.toolchain_cpu), | 437 assert(defined(invoker.toolchain_cpu), |
| 441 "clang_toolchain() must specify a \"toolchain_cpu\"") | 438 "clang_toolchain() must specify a \"toolchain_cpu\"") |
| 442 assert(defined(invoker.toolchain_os), | 439 assert(defined(invoker.toolchain_os), |
| 443 "clang_toolchain() must specify a \"toolchain_os\"") | 440 "clang_toolchain() must specify a \"toolchain_os\"") |
| 444 if (defined(invoker.toolprefix)) { | 441 if (defined(invoker.toolprefix)) { |
| 445 toolprefix = invoker.toolprefix | 442 toolprefix = invoker.toolprefix |
| 446 } else { | 443 } else { |
| 447 toolprefix = "" | 444 toolprefix = "" |
| 448 } | 445 } |
| 449 | 446 |
| 450 gcc_toolchain(target_name) { | 447 gcc_toolchain(target_name) { |
| 451 prefix = rebase_path(clang_dir + "/bin", root_build_dir) | 448 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
| 449 root_build_dir) |
| 452 cc = "$prefix/clang" | 450 cc = "$prefix/clang" |
| 453 cxx = "$prefix/clang++" | 451 cxx = "$prefix/clang++" |
| 454 ld = cxx | 452 ld = cxx |
| 455 is_clang = true | 453 is_clang = true |
| 456 | 454 |
| 457 readelf = "${toolprefix}readelf" | 455 readelf = "${toolprefix}readelf" |
| 458 ar = "${toolprefix}ar" | 456 ar = "${toolprefix}ar" |
| 459 nm = "${toolprefix}nm" | 457 nm = "${toolprefix}nm" |
| 460 | 458 |
| 461 forward_variables_from(invoker, | 459 forward_variables_from(invoker, |
| 462 [ | 460 [ |
| 463 "toolchain_cpu", | 461 "toolchain_cpu", |
| 464 "toolchain_os", | 462 "toolchain_os", |
| 465 "use_gold", | 463 "use_gold", |
| 466 ]) | 464 ]) |
| 467 } | 465 } |
| 468 } | 466 } |
| OLD | NEW |