| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 # by being given the scriptprefix. | 56 # by being given the scriptprefix. |
| 57 if (host_os == "win" && !use_goma && cc_wrapper == "") { | 57 if (host_os == "win" && !use_goma && cc_wrapper == "") { |
| 58 compiler_scriptprefix = scriptprefix | 58 compiler_scriptprefix = scriptprefix |
| 59 } else { | 59 } else { |
| 60 compiler_scriptprefix = "" | 60 compiler_scriptprefix = "" |
| 61 } | 61 } |
| 62 | 62 |
| 63 nacl_toolchain(target_name) { | 63 nacl_toolchain(target_name) { |
| 64 toolchain_package = "pnacl_newlib" | 64 toolchain_package = "pnacl_newlib" |
| 65 toolchain_revision = pnacl_newlib_rev | 65 toolchain_revision = pnacl_newlib_rev |
| 66 toolchain_cpu = "pnacl" | |
| 67 toolprefix = | 66 toolprefix = |
| 68 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-", | 67 rebase_path("${nacl_toolchain_dir}/${toolchain_package}/bin/pnacl-", |
| 69 root_build_dir) | 68 root_build_dir) |
| 70 | 69 |
| 71 is_clang = true | |
| 72 cc = compiler_scriptprefix + toolprefix + "clang" + scriptsuffix | 70 cc = compiler_scriptprefix + toolprefix + "clang" + scriptsuffix |
| 73 cxx = compiler_scriptprefix + toolprefix + "clang++" + scriptsuffix | 71 cxx = compiler_scriptprefix + toolprefix + "clang++" + scriptsuffix |
| 74 ar = scriptprefix + toolprefix + "ar" + scriptsuffix | 72 ar = scriptprefix + toolprefix + "ar" + scriptsuffix |
| 75 readelf = scriptprefix + toolprefix + "readelf" + scriptsuffix | 73 readelf = scriptprefix + toolprefix + "readelf" + scriptsuffix |
| 76 nm = scriptprefix + toolprefix + "nm" + scriptsuffix | 74 nm = scriptprefix + toolprefix + "nm" + scriptsuffix |
| 77 if (defined(invoker.strip)) { | 75 if (defined(invoker.strip)) { |
| 78 strip = scriptprefix + toolprefix + invoker.strip + scriptsuffix | 76 strip = scriptprefix + toolprefix + invoker.strip + scriptsuffix |
| 79 } | 77 } |
| 80 | 78 |
| 81 # Note this is not the usual "ld = cxx" because "ld" uses are | 79 # Note this is not the usual "ld = cxx" because "ld" uses are |
| 82 # never run via goma, so this needs scriptprefix. | 80 # never run via goma, so this needs scriptprefix. |
| 83 ld = scriptprefix + toolprefix + "clang++" + scriptsuffix | 81 ld = scriptprefix + toolprefix + "clang++" + scriptsuffix |
| 84 | 82 |
| 85 executable_extension = invoker.executable_extension | 83 executable_extension = invoker.executable_extension |
| 84 |
| 85 toolchain_args = { |
| 86 is_clang = true |
| 87 current_cpu = "pnacl" |
| 88 } |
| 86 } | 89 } |
| 87 } | 90 } |
| 88 | 91 |
| 89 pnacl_toolchain("newlib_pnacl") { | 92 pnacl_toolchain("newlib_pnacl") { |
| 90 executable_extension = ".pexe" | 93 executable_extension = ".pexe" |
| 91 | 94 |
| 92 # The pnacl-finalize tool turns a .pexe.debug file into a .pexe file. | 95 # The pnacl-finalize tool turns a .pexe.debug file into a .pexe file. |
| 93 # It's very similar in purpose to the traditional "strip" utility: it | 96 # It's very similar in purpose to the traditional "strip" utility: it |
| 94 # turns what comes out of the linker into what you actually want to | 97 # turns what comes out of the linker into what you actually want to |
| 95 # distribute and run. PNaCl doesn't have a "strip"-like utility that | 98 # distribute and run. PNaCl doesn't have a "strip"-like utility that |
| (...skipping 25 matching lines...) Expand all Loading... |
| 121 | 124 |
| 122 # TODO(mcgrathr): Hoist this to top level when | 125 # TODO(mcgrathr): Hoist this to top level when |
| 123 # https://code.google.com/p/chromium/issues/detail?id=395883 is fixed. | 126 # https://code.google.com/p/chromium/issues/detail?id=395883 is fixed. |
| 124 if (host_os == "win") { | 127 if (host_os == "win") { |
| 125 toolsuffix = ".exe" | 128 toolsuffix = ".exe" |
| 126 } else { | 129 } else { |
| 127 toolsuffix = "" | 130 toolsuffix = "" |
| 128 } | 131 } |
| 129 | 132 |
| 130 nacl_toolchain("glibc_" + toolchain_cpu) { | 133 nacl_toolchain("glibc_" + toolchain_cpu) { |
| 131 is_clang = false | |
| 132 is_nacl_glibc = true | |
| 133 | |
| 134 cc = toolprefix + "gcc" + toolsuffix | 134 cc = toolprefix + "gcc" + toolsuffix |
| 135 cxx = toolprefix + "g++" + toolsuffix | 135 cxx = toolprefix + "g++" + toolsuffix |
| 136 ar = toolprefix + "ar" + toolsuffix | 136 ar = toolprefix + "ar" + toolsuffix |
| 137 ld = cxx | 137 ld = cxx |
| 138 readelf = toolprefix + "readelf" + toolsuffix | 138 readelf = toolprefix + "readelf" + toolsuffix |
| 139 nm = toolprefix + "nm" + toolsuffix | 139 nm = toolprefix + "nm" + toolsuffix |
| 140 strip = toolprefix + "strip" + toolsuffix | 140 strip = toolprefix + "strip" + toolsuffix |
| 141 |
| 142 toolchain_args = { |
| 143 current_cpu = toolchain_cpu |
| 144 is_clang = false |
| 145 is_nacl_glibc = true |
| 146 } |
| 141 } | 147 } |
| 142 } | 148 } |
| 143 | 149 |
| 144 nacl_glibc_toolchain("x86") { | 150 nacl_glibc_toolchain("x86") { |
| 145 toolchain_package = "nacl_x86_glibc" | 151 toolchain_package = "nacl_x86_glibc" |
| 146 toolchain_revision = nacl_x86_glibc_rev | 152 toolchain_revision = nacl_x86_glibc_rev |
| 147 | 153 |
| 148 # Rely on the :compiler_cpu_abi config adding the -m32 flag here rather | 154 # Rely on the :compiler_cpu_abi config adding the -m32 flag here rather |
| 149 # than using the i686-nacl binary directly. This is a because i686-nacl-gcc | 155 # 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 | 156 # is a shell script wrapper around x86_64-nacl-gcc and goma has trouble with |
| (...skipping 29 matching lines...) Expand all Loading... |
| 180 | 186 |
| 181 # TODO(mcgrathr): Hoist this to top level when | 187 # TODO(mcgrathr): Hoist this to top level when |
| 182 # https://code.google.com/p/chromium/issues/detail?id=395883 is fixed. | 188 # https://code.google.com/p/chromium/issues/detail?id=395883 is fixed. |
| 183 if (host_os == "win") { | 189 if (host_os == "win") { |
| 184 toolsuffix = ".exe" | 190 toolsuffix = ".exe" |
| 185 } else { | 191 } else { |
| 186 toolsuffix = "" | 192 toolsuffix = "" |
| 187 } | 193 } |
| 188 | 194 |
| 189 nacl_toolchain("clang_newlib_" + toolchain_cpu) { | 195 nacl_toolchain("clang_newlib_" + toolchain_cpu) { |
| 190 is_clang = true | |
| 191 cc = toolprefix + "clang" + toolsuffix | 196 cc = toolprefix + "clang" + toolsuffix |
| 192 cxx = toolprefix + "clang++" + toolsuffix | 197 cxx = toolprefix + "clang++" + toolsuffix |
| 193 ar = toolprefix + "ar" + toolsuffix | 198 ar = toolprefix + "ar" + toolsuffix |
| 194 ld = cxx | 199 ld = cxx |
| 195 readelf = toolprefix + "readelf" + toolsuffix | 200 readelf = toolprefix + "readelf" + toolsuffix |
| 196 nm = toolprefix + "nm" + toolsuffix | 201 nm = toolprefix + "nm" + toolsuffix |
| 197 strip = toolprefix + "strip" + toolsuffix | 202 strip = toolprefix + "strip" + toolsuffix |
| 203 |
| 204 toolchain_args = { |
| 205 current_cpu = toolchain_cpu |
| 206 is_clang = true |
| 207 } |
| 198 } | 208 } |
| 199 } | 209 } |
| 200 | 210 |
| 201 template("nacl_irt_toolchain") { | 211 template("nacl_irt_toolchain") { |
| 202 toolchain_cpu = target_name | 212 toolchain_cpu = target_name |
| 203 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") | 213 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") |
| 204 | 214 |
| 205 # TODO(mcgrathr): See above. | 215 # TODO(mcgrathr): See above. |
| 206 pnacl_newlib_rev = revisions[2] | 216 pnacl_newlib_rev = revisions[2] |
| 207 | 217 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 222 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir) | 232 link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir) |
| 223 | 233 |
| 224 tls_edit_label = | 234 tls_edit_label = |
| 225 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)" | 235 "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)" |
| 226 host_toolchain_out_dir = | 236 host_toolchain_out_dir = |
| 227 rebase_path(get_label_info(tls_edit_label, "root_out_dir"), | 237 rebase_path(get_label_info(tls_edit_label, "root_out_dir"), |
| 228 root_build_dir) | 238 root_build_dir) |
| 229 tls_edit = "${host_toolchain_out_dir}/tls_edit" | 239 tls_edit = "${host_toolchain_out_dir}/tls_edit" |
| 230 | 240 |
| 231 nacl_toolchain("irt_" + toolchain_cpu) { | 241 nacl_toolchain("irt_" + toolchain_cpu) { |
| 232 is_clang = true | |
| 233 cc = toolprefix + "clang" + toolsuffix | 242 cc = toolprefix + "clang" + toolsuffix |
| 234 cxx = toolprefix + "clang++" + toolsuffix | 243 cxx = toolprefix + "clang++" + toolsuffix |
| 235 ar = toolprefix + "ar" + toolsuffix | 244 ar = toolprefix + "ar" + toolsuffix |
| 236 readelf = toolprefix + "readelf" + toolsuffix | 245 readelf = toolprefix + "readelf" + toolsuffix |
| 237 nm = toolprefix + "nm" + toolsuffix | 246 nm = toolprefix + "nm" + toolsuffix |
| 238 strip = toolprefix + "strip" + toolsuffix | 247 strip = toolprefix + "strip" + toolsuffix |
| 239 | 248 |
| 240 # Always build the IRT with full debugging symbols, regardless of | |
| 241 # how Chromium itself is being built (or other NaCl executables). | |
| 242 symbol_level = 2 | |
| 243 | |
| 244 # Some IRT implementations (notably, Chromium's) contain C++ code, | 249 # Some IRT implementations (notably, Chromium's) contain C++ code, |
| 245 # so we need to link w/ the C++ linker. | 250 # so we need to link w/ the C++ linker. |
| 246 ld = "${python_path} ${link_irt} --tls-edit=${tls_edit} --link-cmd=${cxx} --
readelf-cmd=${readelf}" | 251 ld = "${python_path} ${link_irt} --tls-edit=${tls_edit} --link-cmd=${cxx} --
readelf-cmd=${readelf}" |
| 247 | 252 |
| 253 toolchain_args = { |
| 254 current_cpu = toolchain_cpu |
| 255 is_clang = true |
| 256 |
| 257 # Always build the IRT with full debugging symbols, regardless of |
| 258 # how Chromium itself is being built (or other NaCl executables). |
| 259 symbol_level = 2 |
| 260 } |
| 261 |
| 248 # TODO(ncbray): depend on link script | 262 # TODO(ncbray): depend on link script |
| 249 deps = [ | 263 deps = [ |
| 250 tls_edit_label, | 264 tls_edit_label, |
| 251 ] | 265 ] |
| 252 } | 266 } |
| 253 } | 267 } |
| 254 | 268 |
| 255 template("nacl_clang_toolchains") { | 269 template("nacl_clang_toolchains") { |
| 256 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") | 270 assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") |
| 257 nacl_clang_toolchain(target_name) { | 271 nacl_clang_toolchain(target_name) { |
| 258 toolchain_tuple = invoker.toolchain_tuple | 272 toolchain_tuple = invoker.toolchain_tuple |
| 259 } | 273 } |
| 260 nacl_irt_toolchain(target_name) { | 274 nacl_irt_toolchain(target_name) { |
| 261 toolchain_tuple = invoker.toolchain_tuple | 275 toolchain_tuple = invoker.toolchain_tuple |
| 262 } | 276 } |
| 263 } | 277 } |
| 264 | 278 |
| 265 nacl_clang_toolchains("x86") { | 279 nacl_clang_toolchains("x86") { |
| 266 # Rely on :compiler_cpu_abi adding -m32. See nacl_x86_glibc above. | 280 # Rely on :compiler_cpu_abi adding -m32. See nacl_x86_glibc above. |
| 267 toolchain_tuple = "x86_64-nacl" | 281 toolchain_tuple = "x86_64-nacl" |
| 268 } | 282 } |
| 269 | 283 |
| 270 nacl_clang_toolchains("x64") { | 284 nacl_clang_toolchains("x64") { |
| 271 toolchain_tuple = "x86_64-nacl" | 285 toolchain_tuple = "x86_64-nacl" |
| 272 } | 286 } |
| 273 | 287 |
| 274 nacl_clang_toolchains("arm") { | 288 nacl_clang_toolchains("arm") { |
| 275 toolchain_tuple = "arm-nacl" | 289 toolchain_tuple = "arm-nacl" |
| 276 } | 290 } |
| OLD | NEW |