Index: build/toolchain/cros/BUILD.gn |
diff --git a/build/toolchain/cros/BUILD.gn b/build/toolchain/cros/BUILD.gn |
index c45779df9cc8ead60cfc9270c8475aebeaa0d9b0..edbd617511994acc915272ab3858f0fb20063674 100644 |
--- a/build/toolchain/cros/BUILD.gn |
+++ b/build/toolchain/cros/BUILD.gn |
@@ -8,17 +8,9 @@ import("//build/toolchain/gcc_toolchain.gni") |
import("//build/toolchain/cros_toolchain.gni") |
template("cros_target_toolchain") { |
- if (defined(invoker.use_debug_fission)) { |
- use_debug_fission = invoker.use_debug_fission |
- } |
- if (defined(invoker.use_gold)) { |
- use_gold = invoker.use_gold |
- } |
- if (defined(invoker.use_sysroot)) { |
- use_sysroot = invoker.use_sysroot |
- } |
- |
gcc_toolchain(target_name) { |
+ assert(defined(invoker.toolchain_args)) |
+ |
# These are args for the template. |
ar = cros_target_ar |
cc = cros_target_cc |
@@ -38,20 +30,27 @@ template("cros_target_toolchain") { |
extra_cxxflags = cros_target_extra_cxxflags |
extra_ldflags = cros_target_extra_ldflags |
- # These are passed through as toolchain_args. |
- cc_wrapper = "" |
- is_clang = is_clang |
- toolchain_cpu = target_cpu |
- toolchain_os = "chromeos" |
+ toolchain_args = { |
+ forward_variables_from(invoker.toolchain_args, "*") |
+ |
+ cc_wrapper = "" |
- use_debug_fission = use_debug_fission |
- use_gold = use_gold |
- use_sysroot = use_sysroot |
+ # This will override the default computation for is_clang in the |
+ # secondary toolchain with the value of is_clang in the current toolchain |
+ # (the current toolchain will always be the default toolchain here). |
+ is_clang = is_clang |
+ current_cpu = target_cpu |
+ current_os = "chromeos" |
+ use_debug_fission = use_debug_fission |
+ use_sysroot = use_sysroot |
+ } |
} |
} |
# This is the normal toolchain for most targets. |
cros_target_toolchain("target") { |
+ toolchain_args = { |
+ } |
} |
# This is a special toolchain needed just for the nacl_bootstrap target in |
@@ -59,9 +58,11 @@ cros_target_toolchain("target") { |
# to ":target" except that it forces use_debug_fission, use_gold, and |
# use_sysroot off. |
cros_target_toolchain("nacl_bootstrap") { |
- use_debug_fission = false |
- use_gold = false |
- use_sysroot = false |
+ toolchain_args = { |
+ use_debug_fission = false |
+ use_gold = false |
+ use_sysroot = false |
+ } |
} |
gcc_toolchain("host") { |
@@ -84,12 +85,13 @@ gcc_toolchain("host") { |
extra_cxxflags = cros_host_extra_cxxflags |
extra_ldflags = cros_host_extra_ldflags |
- # These are passed through as toolchain_args. |
- cc_wrapper = "" |
- is_clang = cros_host_is_clang |
- toolchain_cpu = host_cpu |
- toolchain_os = "linux" |
- use_sysroot = false |
+ toolchain_args = { |
+ cc_wrapper = "" |
+ is_clang = cros_host_is_clang |
+ current_cpu = host_cpu |
+ current_os = "linux" |
+ use_sysroot = false |
+ } |
} |
gcc_toolchain("v8_snapshot") { |
@@ -112,15 +114,16 @@ gcc_toolchain("v8_snapshot") { |
extra_cxxflags = cros_v8_snapshot_extra_cxxflags |
extra_ldflags = cros_v8_snapshot_extra_ldflags |
- # These are passed through as toolchain_args. |
- cc_wrapper = "" |
- is_clang = cros_v8_snapshot_is_clang |
- if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { |
- toolchain_cpu = "x86" |
- } else { |
- toolchain_cpu = "x64" |
+ toolchain_args = { |
+ cc_wrapper = "" |
+ is_clang = cros_v8_snapshot_is_clang |
+ if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { |
+ current_cpu = "x86" |
+ } else { |
+ current_cpu = "x64" |
+ } |
+ v8_toolchain_cpu = v8_target_cpu |
+ current_os = "linux" |
+ use_sysroot = false |
} |
- v8_toolchain_cpu = v8_target_cpu |
- toolchain_os = "linux" |
- use_sysroot = false |
} |