| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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/compiler/compiler.gni") | 5 import("//build/config/compiler/compiler.gni") |
| 6 import("//build/config/sysroot.gni") | 6 import("//build/config/sysroot.gni") |
| 7 import("//build/toolchain/gcc_toolchain.gni") | 7 import("//build/toolchain/gcc_toolchain.gni") |
| 8 import("//build/toolchain/cros_toolchain.gni") | 8 import("//build/toolchain/cros_toolchain.gni") |
| 9 | 9 |
| 10 template("cros_target_toolchain") { | 10 template("cros_target_toolchain") { |
| 11 if (defined(invoker.use_debug_fission)) { | 11 gcc_toolchain(target_name) { |
| 12 use_debug_fission = invoker.use_debug_fission | 12 assert(defined(invoker.toolchain_args)) |
| 13 } | |
| 14 if (defined(invoker.use_gold)) { | |
| 15 use_gold = invoker.use_gold | |
| 16 } | |
| 17 if (defined(invoker.use_sysroot)) { | |
| 18 use_sysroot = invoker.use_sysroot | |
| 19 } | |
| 20 | 13 |
| 21 gcc_toolchain(target_name) { | |
| 22 # These are args for the template. | 14 # These are args for the template. |
| 23 ar = cros_target_ar | 15 ar = cros_target_ar |
| 24 cc = cros_target_cc | 16 cc = cros_target_cc |
| 25 cxx = cros_target_cxx | 17 cxx = cros_target_cxx |
| 26 ld = cxx | 18 ld = cxx |
| 27 if (cros_target_ld != "") { | 19 if (cros_target_ld != "") { |
| 28 ld = cros_target_ld | 20 ld = cros_target_ld |
| 29 } | 21 } |
| 30 if (cros_target_nm != "") { | 22 if (cros_target_nm != "") { |
| 31 nm = cros_target_nm | 23 nm = cros_target_nm |
| 32 } | 24 } |
| 33 if (cros_target_readelf != "") { | 25 if (cros_target_readelf != "") { |
| 34 readelf = cros_target_readelf | 26 readelf = cros_target_readelf |
| 35 } | 27 } |
| 36 extra_cflags = cros_target_extra_cflags | 28 extra_cflags = cros_target_extra_cflags |
| 37 extra_cppflags = cros_target_extra_cppflags | 29 extra_cppflags = cros_target_extra_cppflags |
| 38 extra_cxxflags = cros_target_extra_cxxflags | 30 extra_cxxflags = cros_target_extra_cxxflags |
| 39 extra_ldflags = cros_target_extra_ldflags | 31 extra_ldflags = cros_target_extra_ldflags |
| 40 | 32 |
| 41 # These are passed through as toolchain_args. | 33 toolchain_args = { |
| 42 cc_wrapper = "" | 34 forward_variables_from(invoker.toolchain_args, "*") |
| 43 is_clang = is_clang | |
| 44 toolchain_cpu = target_cpu | |
| 45 toolchain_os = "chromeos" | |
| 46 | 35 |
| 47 use_debug_fission = use_debug_fission | 36 cc_wrapper = "" |
| 48 use_gold = use_gold | 37 |
| 49 use_sysroot = use_sysroot | 38 # This will override the default computation for is_clang in the |
| 39 # secondary toolchain with the value of is_clang in the current toolchain |
| 40 # (the current toolchain will always be the default toolchain here). |
| 41 is_clang = is_clang |
| 42 current_cpu = target_cpu |
| 43 current_os = "chromeos" |
| 44 use_debug_fission = use_debug_fission |
| 45 use_sysroot = use_sysroot |
| 46 } |
| 50 } | 47 } |
| 51 } | 48 } |
| 52 | 49 |
| 53 # This is the normal toolchain for most targets. | 50 # This is the normal toolchain for most targets. |
| 54 cros_target_toolchain("target") { | 51 cros_target_toolchain("target") { |
| 52 toolchain_args = { |
| 53 } |
| 55 } | 54 } |
| 56 | 55 |
| 57 # This is a special toolchain needed just for the nacl_bootstrap target in | 56 # This is a special toolchain needed just for the nacl_bootstrap target in |
| 58 # //native_client/src/trusted/service_runtime/linux. It is identical | 57 # //native_client/src/trusted/service_runtime/linux. It is identical |
| 59 # to ":target" except that it forces use_debug_fission, use_gold, and | 58 # to ":target" except that it forces use_debug_fission, use_gold, and |
| 60 # use_sysroot off. | 59 # use_sysroot off. |
| 61 cros_target_toolchain("nacl_bootstrap") { | 60 cros_target_toolchain("nacl_bootstrap") { |
| 62 use_debug_fission = false | 61 toolchain_args = { |
| 63 use_gold = false | 62 use_debug_fission = false |
| 64 use_sysroot = false | 63 use_gold = false |
| 64 use_sysroot = false |
| 65 } |
| 65 } | 66 } |
| 66 | 67 |
| 67 gcc_toolchain("host") { | 68 gcc_toolchain("host") { |
| 68 # These are args for the template. | 69 # These are args for the template. |
| 69 ar = cros_host_ar | 70 ar = cros_host_ar |
| 70 cc = cros_host_cc | 71 cc = cros_host_cc |
| 71 cxx = cros_host_cxx | 72 cxx = cros_host_cxx |
| 72 ld = cxx | 73 ld = cxx |
| 73 if (cros_host_ld != "") { | 74 if (cros_host_ld != "") { |
| 74 ld = cros_host_ld | 75 ld = cros_host_ld |
| 75 } | 76 } |
| 76 if (cros_host_nm != "") { | 77 if (cros_host_nm != "") { |
| 77 nm = cros_host_nm | 78 nm = cros_host_nm |
| 78 } | 79 } |
| 79 if (cros_host_readelf != "") { | 80 if (cros_host_readelf != "") { |
| 80 readelf = cros_host_readelf | 81 readelf = cros_host_readelf |
| 81 } | 82 } |
| 82 extra_cflags = cros_host_extra_cflags | 83 extra_cflags = cros_host_extra_cflags |
| 83 extra_cppflags = cros_host_extra_cppflags | 84 extra_cppflags = cros_host_extra_cppflags |
| 84 extra_cxxflags = cros_host_extra_cxxflags | 85 extra_cxxflags = cros_host_extra_cxxflags |
| 85 extra_ldflags = cros_host_extra_ldflags | 86 extra_ldflags = cros_host_extra_ldflags |
| 86 | 87 |
| 87 # These are passed through as toolchain_args. | 88 toolchain_args = { |
| 88 cc_wrapper = "" | 89 cc_wrapper = "" |
| 89 is_clang = cros_host_is_clang | 90 is_clang = cros_host_is_clang |
| 90 toolchain_cpu = host_cpu | 91 current_cpu = host_cpu |
| 91 toolchain_os = "linux" | 92 current_os = "linux" |
| 92 use_sysroot = false | 93 use_sysroot = false |
| 94 } |
| 93 } | 95 } |
| 94 | 96 |
| 95 gcc_toolchain("v8_snapshot") { | 97 gcc_toolchain("v8_snapshot") { |
| 96 # These are args for the template. | 98 # These are args for the template. |
| 97 ar = cros_v8_snapshot_ar | 99 ar = cros_v8_snapshot_ar |
| 98 cc = cros_v8_snapshot_cc | 100 cc = cros_v8_snapshot_cc |
| 99 cxx = cros_v8_snapshot_cxx | 101 cxx = cros_v8_snapshot_cxx |
| 100 ld = cxx | 102 ld = cxx |
| 101 if (cros_v8_snapshot_ld != "") { | 103 if (cros_v8_snapshot_ld != "") { |
| 102 ld = cros_v8_snapshot_ld | 104 ld = cros_v8_snapshot_ld |
| 103 } | 105 } |
| 104 if (cros_v8_snapshot_nm != "") { | 106 if (cros_v8_snapshot_nm != "") { |
| 105 nm = cros_v8_snapshot_nm | 107 nm = cros_v8_snapshot_nm |
| 106 } | 108 } |
| 107 if (cros_v8_snapshot_readelf != "") { | 109 if (cros_v8_snapshot_readelf != "") { |
| 108 readelf = cros_v8_snapshot_readelf | 110 readelf = cros_v8_snapshot_readelf |
| 109 } | 111 } |
| 110 extra_cflags = cros_v8_snapshot_extra_cflags | 112 extra_cflags = cros_v8_snapshot_extra_cflags |
| 111 extra_cppflags = cros_v8_snapshot_extra_cppflags | 113 extra_cppflags = cros_v8_snapshot_extra_cppflags |
| 112 extra_cxxflags = cros_v8_snapshot_extra_cxxflags | 114 extra_cxxflags = cros_v8_snapshot_extra_cxxflags |
| 113 extra_ldflags = cros_v8_snapshot_extra_ldflags | 115 extra_ldflags = cros_v8_snapshot_extra_ldflags |
| 114 | 116 |
| 115 # These are passed through as toolchain_args. | 117 toolchain_args = { |
| 116 cc_wrapper = "" | 118 cc_wrapper = "" |
| 117 is_clang = cros_v8_snapshot_is_clang | 119 is_clang = cros_v8_snapshot_is_clang |
| 118 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { | 120 if (target_cpu == "x86" || target_cpu == "arm" || target_cpu == "mipsel") { |
| 119 toolchain_cpu = "x86" | 121 current_cpu = "x86" |
| 120 } else { | 122 } else { |
| 121 toolchain_cpu = "x64" | 123 current_cpu = "x64" |
| 124 } |
| 125 v8_toolchain_cpu = v8_target_cpu |
| 126 current_os = "linux" |
| 127 use_sysroot = false |
| 122 } | 128 } |
| 123 v8_toolchain_cpu = v8_target_cpu | |
| 124 toolchain_os = "linux" | |
| 125 use_sysroot = false | |
| 126 } | 129 } |
| OLD | NEW |