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/ccache.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 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 # toolchain; if not specified, the toolchain will inherit the | 74 # toolchain; if not specified, the toolchain will inherit the |
75 # default setting. | 75 # default setting. |
76 # - is_nacl_glibc | 76 # - is_nacl_glibc |
77 # Whether NaCl code is built using Glibc instead of Newlib. | 77 # Whether NaCl code is built using Glibc instead of Newlib. |
78 # - use_ccache | 78 # - use_ccache |
79 # Override the global use_ccache setting, useful to opt-out of ccache in | 79 # Override the global use_ccache setting, useful to opt-out of ccache in |
80 # a particular toolchain by setting use_ccache = false in it. | 80 # a particular toolchain by setting use_ccache = false in it. |
81 # - use_goma | 81 # - use_goma |
82 # Override the global use_goma setting, useful to opt-out of goma in a | 82 # Override the global use_goma setting, useful to opt-out of goma in a |
83 # particular toolchain by setting use_gome = false in it. | 83 # particular toolchain by setting use_gome = false in it. |
| 84 # - use_gold |
| 85 # Override the global use_gold setting, useful if the particular |
| 86 # toolchain has a custom link step that is not actually using Gold. |
84 template("gcc_toolchain") { | 87 template("gcc_toolchain") { |
85 toolchain(target_name) { | 88 toolchain(target_name) { |
86 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 89 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
87 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 90 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
88 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 91 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
89 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 92 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
90 assert(defined(invoker.toolchain_cpu), | 93 assert(defined(invoker.toolchain_cpu), |
91 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 94 "gcc_toolchain() must specify a \"toolchain_cpu\"") |
92 assert(defined(invoker.toolchain_os), | 95 assert(defined(invoker.toolchain_os), |
93 "gcc_toolchain() must specify a \"toolchain_os\"") | 96 "gcc_toolchain() must specify a \"toolchain_os\"") |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 | 340 |
338 # These values need to be passed through unchanged. | 341 # These values need to be passed through unchanged. |
339 target_os = target_os | 342 target_os = target_os |
340 target_cpu = target_cpu | 343 target_cpu = target_cpu |
341 | 344 |
342 forward_variables_from(invoker, | 345 forward_variables_from(invoker, |
343 [ | 346 [ |
344 "is_clang", | 347 "is_clang", |
345 "is_component_build", | 348 "is_component_build", |
346 "is_nacl_glibc", | 349 "is_nacl_glibc", |
| 350 "use_gold", |
347 ]) | 351 ]) |
348 | 352 |
349 if (defined(invoker.clear_sanitizers) && invoker.clear_sanitizers) { | 353 if (defined(invoker.clear_sanitizers) && invoker.clear_sanitizers) { |
350 is_asan = false | 354 is_asan = false |
351 is_cfi = false | 355 is_cfi = false |
352 is_lsan = false | 356 is_lsan = false |
353 is_msan = false | 357 is_msan = false |
354 is_syzyasan = false | 358 is_syzyasan = false |
355 is_tsan = false | 359 is_tsan = false |
356 is_ubsan = false | 360 is_ubsan = false |
357 } | 361 } |
358 } | 362 } |
359 | 363 |
360 forward_variables_from(invoker, [ "deps" ]) | 364 forward_variables_from(invoker, [ "deps" ]) |
361 } | 365 } |
362 } | 366 } |
| 367 |
| 368 # This is a shorthand for gcc_toolchain instances based on the |
| 369 # Chromium-built version of Clang. Only the toolchain_cpu and |
| 370 # toolchain_os variables need to be specified by the invoker, and |
| 371 # optionally toolprefix if it's a cross-compile case. Note that for |
| 372 # a cross-compile case this toolchain requires a config to pass the |
| 373 # appropriate -target option, or else it will actually just be doing |
| 374 # a native compile. The invoker can optionally override use_gold too. |
| 375 template("clang_toolchain") { |
| 376 assert(defined(invoker.toolchain_cpu), |
| 377 "clang_toolchain() must specify a \"toolchain_cpu\"") |
| 378 assert(defined(invoker.toolchain_os), |
| 379 "clang_toolchain() must specify a \"toolchain_os\"") |
| 380 if (defined(invoker.toolprefix)) { |
| 381 toolprefix = invoker.toolprefix |
| 382 } else { |
| 383 toolprefix = "" |
| 384 } |
| 385 |
| 386 gcc_toolchain(target_name) { |
| 387 prefix = rebase_path("//third_party/llvm-build/Release+Asserts/bin", |
| 388 root_build_dir) |
| 389 cc = "$prefix/clang" |
| 390 cxx = "$prefix/clang++" |
| 391 ld = cxx |
| 392 is_clang = true |
| 393 |
| 394 readelf = "${toolprefix}readelf" |
| 395 ar = "${toolprefix}ar" |
| 396 nm = "${toolprefix}nm" |
| 397 |
| 398 forward_variables_from(invoker, |
| 399 [ |
| 400 "toolchain_cpu", |
| 401 "toolchain_os", |
| 402 "use_gold", |
| 403 ]) |
| 404 } |
| 405 } |
OLD | NEW |