Index: build/toolchain/nacl/BUILD.gn |
diff --git a/build/toolchain/nacl/BUILD.gn b/build/toolchain/nacl/BUILD.gn |
index 5bda55280fff87351c51ae922dc50a88babe5bea..c3dcaf17c9e363dde3092257a62b72c8c544dde3 100644 |
--- a/build/toolchain/nacl/BUILD.gn |
+++ b/build/toolchain/nacl/BUILD.gn |
@@ -139,77 +139,50 @@ nacl_toolchain("clang_newlib_x64") { |
ld = cxx |
} |
-link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir) |
+template("nacl_irt_toolchain") { |
+ toolchain_cpu = target_name |
+ assert(defined(invoker.toolchain_tuple), "Must define toolchain_tuple") |
-nacl_toolchain("irt_x86") { |
toolchain_package = "pnacl_newlib" |
toolchain_revision = pnacl_newlib_rev |
- toolchain_cpu = "x86" |
- toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/i686-nacl-" |
- is_clang = true |
+ toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/" + |
+ invoker.toolchain_tuple + "-" |
- cc = toolprefix + "clang" |
- cxx = toolprefix + "clang++" |
- ar = toolprefix + "ar" |
- readelf = toolprefix + "readelf" |
+ link_irt = rebase_path("//native_client/build/link_irt.py", root_build_dir) |
tls_edit_label = |
"//native_client/src/tools/tls_edit:tls_edit($host_toolchain)" |
host_toolchain_out_dir = |
rebase_path(get_label_info(tls_edit_label, "root_out_dir"), |
root_build_dir) |
- |
- # Some IRT implementations (notably, Chromium's) contain C++ code, |
- # so we need to link w/ the C++ linker. |
- ld = "${python_path} ${link_irt} --tls-edit=${host_toolchain_out_dir}/tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}" |
- |
- # TODO(ncbray): depend on link script |
- deps = [ |
- tls_edit_label, |
- ] |
+ tls_edit = "${host_toolchain_out_dir}/tls_edit" |
+ |
+ nacl_toolchain("irt_" + toolchain_cpu) { |
+ is_clang = true |
+ cc = toolprefix + "clang" |
+ cxx = toolprefix + "clang++" |
+ ar = toolprefix + "ar" |
+ readelf = toolprefix + "readelf" |
+ |
+ # Some IRT implementations (notably, Chromium's) contain C++ code, |
+ # so we need to link w/ the C++ linker. |
+ ld = "${python_path} ${link_irt} --tls-edit=${tls_edit} --link-cmd=${cxx} --readelf-cmd=${readelf}" |
+ |
+ # TODO(ncbray): depend on link script |
+ deps = [ |
+ tls_edit_label, |
+ ] |
+ } |
} |
-nacl_toolchain("irt_x64") { |
- toolchain_package = "pnacl_newlib" |
- toolchain_revision = pnacl_newlib_rev |
- toolchain_cpu = "x64" |
- toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/x86_64-nacl-" |
- is_clang = true |
- |
- cc = toolprefix + "clang" |
- cxx = toolprefix + "clang++" |
- ar = toolprefix + "ar" |
- readelf = toolprefix + "readelf" |
- |
- # Some IRT implementations (notably, Chromium's) contain C++ code, |
- # so we need to link w/ the C++ linker. |
- ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}" |
- |
- # TODO(ncbray): depend on link script |
- deps = [ |
- "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)", |
- ] |
+nacl_irt_toolchain("x86") { |
+ toolchain_tuple = "i686-nacl" |
} |
-# Uses newlib to match the Chrome build. |
-nacl_toolchain("irt_arm") { |
- toolchain_package = "nacl_arm_newlib" |
- toolchain_revision = nacl_arm_newlib_rev |
- toolchain_cpu = "arm" |
- toolprefix = "${os_toolchain_dir}/${toolchain_package}/bin/arm-nacl-" |
- is_clang = false |
- |
- cc = toolprefix + "gcc" |
- cxx = toolprefix + "g++" |
- ar = toolprefix + "ar" |
- readelf = toolprefix + "readelf" |
- |
- # Some IRT implementations (notably, Chromium's) contain C++ code, |
- # so we need to link w/ the C++ linker. |
- ld = "${python_path} ${link_irt} --tls-edit=tls_edit --link-cmd=${cxx} --readelf-cmd=${readelf}" |
+nacl_irt_toolchain("x64") { |
+ toolchain_tuple = "x86_64-nacl" |
+} |
- # TODO(ncbray): depend on link script |
- deps = [ |
- "//native_client/src/tools/tls_edit:tls_edit($host_toolchain)", |
- ] |
+nacl_irt_toolchain("arm") { |
+ toolchain_tuple = "arm-nacl" |
} |