@@ -7,9 +7,25 @@ import("//build/toolchain/clang.gni")
77import (" //build/toolchain/rbe.gni" )
88import (" //build/toolchain/toolchain.gni" )
99
10+ if (target_cpu == " x64" ) {
11+ target_triple = " x86_64-unknown-fuchsia"
12+ } else if (target_cpu == " arm64" ) {
13+ target_triple = " aarch64-unknown-fuchsia"
14+ } else {
15+ assert (false , " Unsupported target_cpu: $target_cpu " )
16+ }
17+
1018if (use_rbe ) {
11- compiler_args =
12- rewrapper_command + [ " --labels=type=compile,compiler=clang,lang=cpp " ]
19+ remote_wrapper =
20+ rebase_path (" //flutter/build/rbe/remote_wrapper_linux.sh" , root_build_dir )
21+ local_wrapper =
22+ rebase_path (" //flutter/build/rbe/local_wrapper.sh" , root_build_dir )
23+ compiler_args = rewrapper_command + [
24+ " --remote_wrapper=$remote_wrapper " ,
25+ " --local_wrapper=$local_wrapper " ,
26+ " --labels=type=compile,compiler=clang,lang=cpp" ,
27+ " --inputs=$buildtools_path /${ host_os } -${ host_cpu } /clang/include/$target_triple /c++/v1/__config_site" ,
28+ ]
1329 compiler_prefix = string_join (" " , compiler_args )
1430 link_prefix = " "
1531} else if (use_ccache ) {
@@ -26,8 +42,7 @@ toolchain("fuchsia") {
2642 " We currently only support 'x64' and 'arm64' targets for fuchsia." )
2743 toolchain_bin =
2844 rebase_path (" $buildtools_path /${ host_os } -${ host_cpu } /clang/bin" ,
29- root_out_dir )
30- fuchsia_sdk = rebase_path (" //third_party/fuchsia-sdk/sdk" , root_out_dir )
45+ root_build_dir )
3146
3247 # We can't do string interpolation ($ in strings) on things with dots in
3348 # them. To allow us to use $cc below, for example, we create copies of
@@ -40,14 +55,6 @@ toolchain("fuchsia") {
4055 nm = " ${ toolchain_bin } /llvm-nm"
4156 strip = " ${ toolchain_bin } /llvm-strip"
4257
43- if (target_cpu == " arm64" ) {
44- target_triple_flags = " --target=aarch64-fuchsia"
45- } else {
46- target_triple_flags = " --target=x86_64-fuchsia"
47- }
48-
49- sysroot_flags = " --sysroot ${ fuchsia_sdk } /arch/${ target_cpu } /sysroot"
50-
5158 # These library switches can apply to all tools below.
5259 lib_switch = " -l"
5360 lib_dir_switch = " -L"
@@ -59,7 +66,7 @@ toolchain("fuchsia") {
5966
6067 tool (" cc" ) {
6168 depfile = " {{output}}.d"
62- command = " $compiler_prefix $cc -MD -MF $depfile $target_triple_flags $sysroot_flags $lto_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
69+ command = " $compiler_prefix $cc -MMD -MF $depfile $lto_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
6370 depsformat = " gcc"
6471 description = " CC {{output}}"
6572 outputs =
@@ -68,7 +75,7 @@ toolchain("fuchsia") {
6875
6976 tool (" cxx" ) {
7077 depfile = " {{output}}.d"
71- command = " $compiler_prefix $cxx -MD -MF $depfile $target_triple_flags $sysroot_flags $lto_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
78+ command = " $compiler_prefix $cxx -MMD -MF $depfile $lto_flags {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
7279 depsformat = " gcc"
7380 description = " CXX {{output}}"
7481 outputs =
@@ -77,7 +84,7 @@ toolchain("fuchsia") {
7784
7885 tool (" asm" ) {
7986 depfile = " {{output}}.d"
80- command = " $cc -MD -MF $depfile $target_triple_flags $sysroot_flags $lto_flags {{defines}} {{include_dirs}} {{asmflags}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
87+ command = " $cc -MMD -MF $depfile $lto_flags {{defines}} {{include_dirs}} {{asmflags}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
8188 depsformat = " gcc"
8289 description = " ASM {{output}}"
8390 outputs =
@@ -109,7 +116,7 @@ toolchain("fuchsia") {
109116 # existing .TOC file, overwrite it, otherwise, don't change it.
110117 tocfile = sofile + " .TOC"
111118 temporary_tocname = sofile + " .tmp"
112- link_command = " $link_prefix $ld $target_triple_flags $sysroot_flags $ lto_flags -shared {{ldflags}} -o $unstripped_sofile -Wl,--build-id=sha1 -Wl,-soname=$soname @$rspfile "
119+ link_command = " $link_prefix $ld $lto_flags -shared {{ldflags}} -o $unstripped_sofile -Wl,--build-id=sha1 -Wl,-soname=$soname @$rspfile "
113120 toc_command = " { $readelf -d $unstripped_sofile | grep SONAME ; $nm -gD -f p $unstripped_sofile | cut -f1-2 -d' '; } > $temporary_tocname "
114121 replace_command = " if ! cmp -s $temporary_tocname $tocfile ; then mv $temporary_tocname $tocfile ; fi"
115122 strip_command = " $strip -o $sofile $unstripped_sofile "
@@ -146,7 +153,7 @@ toolchain("fuchsia") {
146153 outfile = " {{root_out_dir}}/$exename "
147154 rspfile = " $outfile .rsp"
148155 unstripped_outfile = " {{root_out_dir}}/exe.unstripped/$exename "
149- command = " $link_prefix $ld $target_triple_flags $sysroot_flags $ lto_flags {{ldflags}} -o $unstripped_outfile -Wl,--build-id=sha1 -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}} && ${ strip } -o $outfile $unstripped_outfile "
156+ command = " $link_prefix $ld $lto_flags {{ldflags}} -o $unstripped_outfile -Wl,--build-id=sha1 -Wl,--start-group @$rspfile {{solibs}} -Wl,--end-group {{libs}} && ${ strip } -o $outfile $unstripped_outfile "
150157 description = " LINK $outfile "
151158 rspfile_content = " {{inputs}}"
152159 outputs = [
0 commit comments