OLD | NEW |
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client 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/sysroot.gni") | 5 import("//build/config/sysroot.gni") |
6 import("//build/config/nacl/config.gni") | 6 import("//build/config/nacl/config.gni") |
7 import("//build/toolchain/nacl_toolchain.gni") | 7 import("//build/toolchain/nacl_toolchain.gni") |
8 | 8 |
9 # Add the toolchain revision as a preprocessor define so that sources are | 9 # Add the toolchain revision as a preprocessor define so that sources are |
10 # rebuilt when a toolchain is updated. | 10 # rebuilt when a toolchain is updated. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 strip = "finalize" | 99 strip = "finalize" |
100 } | 100 } |
101 | 101 |
102 pnacl_toolchain("newlib_pnacl_nonsfi") { | 102 pnacl_toolchain("newlib_pnacl_nonsfi") { |
103 executable_extension = "" | 103 executable_extension = "" |
104 strip = "strip" | 104 strip = "strip" |
105 } | 105 } |
106 | 106 |
107 template("nacl_glibc_toolchain") { | 107 template("nacl_glibc_toolchain") { |
108 toolchain_cpu = target_name | 108 toolchain_cpu = target_name |
109 toolchain_cc_args = "" | |
110 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") | 109 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") |
111 assert(defined(invoker.toolchain_package), "Must define toolchain_package") | 110 assert(defined(invoker.toolchain_package), "Must define toolchain_package") |
112 assert(defined(invoker.toolchain_revision), "Must define toolchain_revision") | 111 assert(defined(invoker.toolchain_revision), "Must define toolchain_revision") |
113 forward_variables_from(invoker, | 112 forward_variables_from(invoker, |
114 [ | 113 [ |
115 "toolchain_package", | 114 "toolchain_package", |
116 "toolchain_revision", | 115 "toolchain_revision", |
117 "toolchain_cc_args", | |
118 ]) | 116 ]) |
119 | 117 |
120 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" + | 118 toolprefix = rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/" + |
121 invoker.toolchain_tuple + "-", | 119 invoker.toolchain_tuple + "-", |
122 root_build_dir) | 120 root_build_dir) |
123 | 121 |
124 # TODO(mcgrathr): Hoist this to top level when | 122 # TODO(mcgrathr): Hoist this to top level when |
125 # https://code.google.com/p/chromium/issues/detail?id=395883 is fixed. | 123 # https://code.google.com/p/chromium/issues/detail?id=395883 is fixed. |
126 if (host_os == "win") { | 124 if (host_os == "win") { |
127 toolsuffix = ".exe" | 125 toolsuffix = ".exe" |
128 } else { | 126 } else { |
129 toolsuffix = "" | 127 toolsuffix = "" |
130 } | 128 } |
131 | 129 |
132 nacl_toolchain("glibc_" + toolchain_cpu) { | 130 nacl_toolchain("glibc_" + toolchain_cpu) { |
133 is_clang = false | 131 is_clang = false |
134 is_nacl_glibc = true | 132 is_nacl_glibc = true |
135 | 133 |
136 cc = toolprefix + "gcc" + toolsuffix + toolchain_cc_args | 134 cc = toolprefix + "gcc" + toolsuffix |
137 cxx = toolprefix + "g++" + toolsuffix + toolchain_cc_args | 135 cxx = toolprefix + "g++" + toolsuffix |
138 ar = toolprefix + "ar" + toolsuffix | 136 ar = toolprefix + "ar" + toolsuffix |
139 ld = cxx | 137 ld = cxx |
140 readelf = toolprefix + "readelf" + toolsuffix | 138 readelf = toolprefix + "readelf" + toolsuffix |
141 nm = toolprefix + "nm" + toolsuffix | 139 nm = toolprefix + "nm" + toolsuffix |
142 strip = toolprefix + "strip" + toolsuffix | 140 strip = toolprefix + "strip" + toolsuffix |
143 } | 141 } |
144 } | 142 } |
145 | 143 |
146 nacl_glibc_toolchain("x86") { | 144 nacl_glibc_toolchain("x86") { |
147 toolchain_package = "nacl_x86_glibc" | 145 toolchain_package = "nacl_x86_glibc" |
148 toolchain_revision = nacl_x86_glibc_rev | 146 toolchain_revision = nacl_x86_glibc_rev |
149 | 147 |
150 # i686-nacl-gcc is not in goma (adding it would be tricky) so we use | 148 # Rely on the :compiler_cpu_abi config adding the -m32 flag here rather |
151 # x86_64-nacl compiler with the -m32 flags. | 149 # than using the i686-nacl binary directly. This is a because i686-nacl-gcc |
| 150 # is a shell script wrapper around x86_64-nacl-gcc and goma has trouble with |
| 151 # compiler executables that are shell scripts (so the i686 'compiler' is not |
| 152 # currently in goma). |
152 toolchain_tuple = "x86_64-nacl" | 153 toolchain_tuple = "x86_64-nacl" |
153 toolchain_cc_args = " -m32" | |
154 } | 154 } |
155 | 155 |
156 nacl_glibc_toolchain("x64") { | 156 nacl_glibc_toolchain("x64") { |
157 toolchain_package = "nacl_x86_glibc" | 157 toolchain_package = "nacl_x86_glibc" |
158 toolchain_revision = nacl_x86_glibc_rev | 158 toolchain_revision = nacl_x86_glibc_rev |
159 toolchain_tuple = "x86_64-nacl" | 159 toolchain_tuple = "x86_64-nacl" |
160 } | 160 } |
161 | 161 |
162 nacl_glibc_toolchain("arm") { | 162 nacl_glibc_toolchain("arm") { |
163 toolchain_package = "nacl_arm_glibc" | 163 toolchain_package = "nacl_arm_glibc" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") | 256 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") |
257 nacl_clang_toolchain(target_name) { | 257 nacl_clang_toolchain(target_name) { |
258 toolchain_tuple = invoker.toolchain_tuple | 258 toolchain_tuple = invoker.toolchain_tuple |
259 } | 259 } |
260 nacl_irt_toolchain(target_name) { | 260 nacl_irt_toolchain(target_name) { |
261 toolchain_tuple = invoker.toolchain_tuple | 261 toolchain_tuple = invoker.toolchain_tuple |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 nacl_clang_toolchains("x86") { | 265 nacl_clang_toolchains("x86") { |
266 toolchain_tuple = "i686-nacl" | 266 # Rely on :compiler_cpu_abi adding -m32. See nacl_x86_glibc above. |
| 267 toolchain_tuple = "x86_64-nacl" |
267 } | 268 } |
268 | 269 |
269 nacl_clang_toolchains("x64") { | 270 nacl_clang_toolchains("x64") { |
270 toolchain_tuple = "x86_64-nacl" | 271 toolchain_tuple = "x86_64-nacl" |
271 } | 272 } |
272 | 273 |
273 nacl_clang_toolchains("arm") { | 274 nacl_clang_toolchains("arm") { |
274 toolchain_tuple = "arm-nacl" | 275 toolchain_tuple = "arm-nacl" |
275 } | 276 } |
OLD | NEW |