@@ -7,18 +7,39 @@ import("//build/toolchain/ccache.gni")
77import (" //build/toolchain/gcc_toolchain.gni" )
88import (" //build/toolchain/rbe.gni" )
99
10- if (use_ccache ) {
11- assembler_prefix = " ccache "
12- compiler_prefix = " ccache "
13- link_prefix = " ccache "
14- } else {
15- assembler_prefix = " "
16- compiler_prefix = " "
17- link_prefix = " "
18- }
19-
2010template (" fuchsia_toolchain" ) {
2111 toolchain (target_name ) {
12+ if (use_rbe ) {
13+ compiler_args =
14+ rewrapper_args + [ " --labels=type=compile,compiler=clang,lang=cpp" ]
15+ if (target_cpu == " x64" ) {
16+ target_triple = " x86_64-unknown-fuchsia"
17+ } else if (target_cpu == " arm64" ) {
18+ target_triple = " aarch64-unknown-fuchsia"
19+ } else if (target_cpu == " riscv64" ) {
20+ target_triple = " riscv64-unknown-fuchsia"
21+ } else {
22+ assert (false , " Unsupported target_cpu: $target_cpu " )
23+ }
24+ compiler_args += [ " --inputs=build/rbe,buildtools/$rbe_os -$rbe_cpu /clang/bin/llvm,buildtools/$rbe_os -$rbe_cpu /clang/include/$target_triple /c++/v1/__config_site" ]
25+
26+ # TODO: Unfortunately I see no way to get build_arch reliably.
27+ if (rbe_os != host_os ) {
28+ compiler_args += [ " --remote_wrapper=../../build/rbe/llvm.sh" ]
29+ }
30+ assembler_prefix = " "
31+ compiler_prefix = string_join (" " , compiler_args ) + " "
32+ link_prefix = " "
33+ } else if (use_ccache ) {
34+ assembler_prefix = " ccache "
35+ compiler_prefix = " ccache "
36+ link_prefix = " ccache "
37+ } else {
38+ assembler_prefix = " "
39+ compiler_prefix = " "
40+ link_prefix = " "
41+ }
42+
2243 toolchain_bin =
2344 rebase_path (" //buildtools/$host_os -x64/clang/bin" , root_out_dir )
2445 fuchsia_sdk =
0 commit comments