diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni index 9418f5cea3b1b6..aab1d9d4437fab 100644 --- a/build/toolchain/gcc_toolchain.gni +++ b/build/toolchain/gcc_toolchain.gni @@ -206,16 +206,26 @@ template("gcc_toolchain") { } else { compiler_prefix = "${toolchain_cc_wrapper} " } - if (use_goma_thin_lto && toolchain_uses_goma && use_thin_lto) { + + if (defined(toolchain_args.use_rbe_links)) { + toolchain_uses_rbe_links = toolchain_args.use_rbe_links + } else { + toolchain_uses_rbe_links = use_rbe_links + } + + if (toolchain_uses_rbe_links) { + link_prefix = "${rbe_bin_dir}/rewrapper -cfg=../../buildtools/reclient_cfgs/rewrapper_linux_link.cfg -exec_root=${rbe_exec_root} " + not_needed([ "goma_path" ]) + } else if (use_goma_thin_lto && toolchain_uses_goma && use_thin_lto) { # goma_ld.py uses autoninja in an attempt to set a reasonable # number of jobs, but this results in too low a value on # Chrome OS builders. So we pass in an explicit value. - goma_ld = + link_prefix = "$python_path " + rebase_path("//tools/clang/scripts/goma_ld.py", root_build_dir) + " --gomacc ${goma_path} --jobs 200 -- " } else { - goma_ld = "" + link_prefix = "" not_needed([ "goma_path" ]) } @@ -268,7 +278,7 @@ template("gcc_toolchain") { cxx = compiler_prefix + invoker.cxx asm = asm_prefix + invoker.cc ar = invoker.ar - ld = "$goma_ld${invoker.ld}" + ld = link_prefix + invoker.ld if (defined(invoker.readelf)) { readelf = invoker.readelf } else { @@ -408,7 +418,10 @@ template("gcc_toolchain") { soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". sofile = "{{output_dir}}/$soname" # Possibly including toolchain dir. rspfile = sofile + ".rsp" - pool = "//build/toolchain:link_pool($default_toolchain)" + + if (!use_rbe_links) { + pool = "//build/toolchain:link_pool($default_toolchain)" + } if (defined(invoker.strip)) { unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" @@ -504,7 +517,10 @@ template("gcc_toolchain") { soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so". sofile = "{{output_dir}}/$soname" rspfile = sofile + ".rsp" - pool = "//build/toolchain:link_pool($default_toolchain)" + + if (!use_rbe_links) { + pool = "//build/toolchain:link_pool($default_toolchain)" + } if (defined(invoker.strip)) { unstripped_sofile = "{{root_out_dir}}/lib.unstripped/$soname" @@ -550,7 +566,10 @@ template("gcc_toolchain") { outfile = "{{output_dir}}/$exename" rspfile = "$outfile.rsp" unstripped_outfile = outfile - pool = "//build/toolchain:link_pool($default_toolchain)" + + if (!use_rbe_links) { + pool = "//build/toolchain:link_pool($default_toolchain)" + } # Use this for {{output_extension}} expansions unless a target manually # overrides it (in which case {{output_extension}} will be what the target diff --git a/build/toolchain/nacl_toolchain.gni b/build/toolchain/nacl_toolchain.gni index 100c0b09658d7f..4d3257fc477f61 100644 --- a/build/toolchain/nacl_toolchain.gni +++ b/build/toolchain/nacl_toolchain.gni @@ -66,6 +66,9 @@ template("nacl_toolchain") { rbe_cc_cfg_file = "${rbe_cfg_dir}/rewrapper_linux_nacl.cfg" } } + + # Nacl Links are not yet supported. + use_rbe_links = false } } } diff --git a/build/toolchain/rbe.gni b/build/toolchain/rbe.gni index cf1848c9c0a7b6..6c7b5f8e4e44ff 100644 --- a/build/toolchain/rbe.gni +++ b/build/toolchain/rbe.gni @@ -16,6 +16,9 @@ declare_args() { # Set to true to enable remote compilation using RBE. use_rbe = false + # Set to true to enable remote compilation of links using RBE. + use_rbe_links = false + # Set to the path of the RBE reclient configuration file. rbe_cc_cfg_file = "" } diff --git a/buildtools/reclient_cfgs/rewrapper_linux.cfg b/buildtools/reclient_cfgs/rewrapper_linux.cfg index 86b91e2df404c8..73dfedeef88be9 100644 --- a/buildtools/reclient_cfgs/rewrapper_linux.cfg +++ b/buildtools/reclient_cfgs/rewrapper_linux.cfg @@ -2,4 +2,4 @@ platform=container-image=docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-0 server_address=unix:///tmp/reproxy.sock labels=type=compile,compiler=clang,lang=cpp exec_strategy=remote_local_fallback -inputs=third_party/llvm-build/Release+Asserts/bin/clang,third_party/llvm-build/Release+Asserts/bin/clang++,third_party/llvm-build/Release+Asserts/bin/clang-cl,third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6 +inputs=third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6 diff --git a/buildtools/reclient_cfgs/rewrapper_linux_link.cfg b/buildtools/reclient_cfgs/rewrapper_linux_link.cfg new file mode 100644 index 00000000000000..317dd33735486d --- /dev/null +++ b/buildtools/reclient_cfgs/rewrapper_linux_link.cfg @@ -0,0 +1,5 @@ +platform=container-image=docker://gcr.io/foundry-x-experiments/chrome-test-builder@sha256:d3646f1c57b57076684cd9f152033acb6d16427231abcbe45c0a36f24148aca4 +server_address=unix:///tmp/reproxy.sock +labels=type=link,tool=clang +exec_strategy=remote +inputs=third_party/llvm-build/Release+Asserts,build/linux/debian_sid_amd64-sysroot/usr/lib/gcc diff --git a/buildtools/reclient_cfgs/rewrapper_linux_nacl.cfg b/buildtools/reclient_cfgs/rewrapper_linux_nacl.cfg index e22419e9a3e9e5..1a77bce90a0e4d 100644 --- a/buildtools/reclient_cfgs/rewrapper_linux_nacl.cfg +++ b/buildtools/reclient_cfgs/rewrapper_linux_nacl.cfg @@ -2,4 +2,4 @@ platform=container-image=docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-0 server_address=unix:///tmp/reproxy.sock labels=type=compile,compiler=nacl,lang=cpp exec_strategy=remote_local_fallback -inputs=third_party/llvm-build/Release+Asserts/bin/clang,third_party/llvm-build/Release+Asserts/bin/clang++,third_party/llvm-build/Release+Asserts/bin/clang-cl,third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6,native_client/toolchain/linux_x86/pnacl_newlib +inputs=third_party/llvm-build/Release+Asserts/lib/libstdc++.so.6,native_client/toolchain/linux_x86/pnacl_newlib