blob: 0b94fb60ef8ced6aff9fcdea15525f55c8f5f7e7 [file] [log] [blame]
# Copyright 2016 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/clang/clang.gni")
import("//build/rust/config.gni")
import("//build/toolchain/breakpad.gni")
import("//build/toolchain/ccache.gni")
import("//build/toolchain/concurrent_jobs.gni")
import("//build/toolchain/default_tools.gni")
import("//build/toolchain/goma.gni")
# Defines a Clang-based toolchain.
#
# Parameters
#
# toolchain_cpu
# Required: Value of "current_cpu" inside this toolchain.
#
# toolchain_os
# Required: Value of "current_os" inside this toolchain.
#
# toolchain_args
# Optional: Scope specifying build arguments to override in this
# toolchain context.
# NOTE! Do not use this in the toolchain used as the default toolchain.
# It will have no effect, and you will be confused.
#
# use_strip
# Required: Whether to strip binaries, leaving unstripped ones
# in lib.unstripped and exe.unstripped subdirectories.
#
# prefix
# Optional: The path from which "cc", "cxx", "ar", "ld" and
# "strip" will be found (unless overridden). If not given,
# prefix defaults to $clang_prefix.
#
# cc
# cxx
# ar
# ld
# strip
# Optional: Override default tool names.
#
# use_ccache, use_goma
# Optional: Override the global setting, useful to opt out of
# ccache/goma in a particular toolchain.
#
# deps
# Optional: Dependencies of this toolchain.
#
# propagates_configs
# Optional: public_configs should escape this toolchain via deps
#
template("clang_toolchain") {
toolchain(target_name) {
assert(defined(invoker.toolchain_cpu),
"clang_toolchain() must specify a \"toolchain_cpu\"")
assert(defined(invoker.toolchain_os),
"clang_toolchain() must specify a \"toolchain_os\"")
compiler_prefix = ""
if (defined(invoker.use_goma)) {
use_goma = invoker.use_goma
}
if (use_goma) {
goma_dir = rebase_path(goma_dir)
compiler_prefix = "$goma_dir/gomacc "
} else {
if (defined(invoker.use_ccache)) {
use_ccache = invoker.use_ccache
}
if (use_ccache) {
compiler_prefix = "ccache "
}
}
prefix = clang_prefix
if (defined(invoker.prefix)) {
prefix = invoker.prefix
}
# Set all tools to defaults
cc = "${prefix}/clang"
cxx = "${prefix}/clang++"
ar = "${prefix}/llvm-ar"
ld = cxx
rustc = "${rustc_prefix}/rustc"
verify_depfile = string_join(" ",
[
rebase_path(python_exe_src, root_build_dir),
# Speed up startup time by not searching for
# site packages.
"-S",
rebase_path("//build/gn/verify_depfile.py",
root_build_dir),
])
forward_variables_from(invoker, [ "use_strip" ])
if (use_strip) {
if (invoker.toolchain_os == "mac") {
strip = "xcrun strip -Sx"
} else {
strip = "${prefix}/llvm-objcopy"
buildidtool = rebase_path(
"//prebuilt/tools/buildidtool/${host_platform}/buildidtool",
root_build_dir)
if (output_breakpad_syms && invoker.toolchain_os == "fuchsia") {
dump_syms = breakpad_dump_syms
# The breakpad module name for executables and loadable modules.
breakpad_name = "<_>"
}
if (output_gsym && invoker.toolchain_os == "fuchsia") {
# TODO(fxbug.dev/58294): enable for other targets.
gsymutil = "${prefix}/llvm-gsymutil"
}
}
}
# Override any tools as requested by the invoker
if (defined(invoker.cc)) {
cc = invoker.cc
}
if (defined(invoker.cxx)) {
cxx = invoker.cxx
}
forward_variables_from(invoker,
[
"ar",
"deps",
"ld",
"propagates_configs",
"strip",
])
# These library switches can apply to all tools below.
lib_switch = "-l"
lib_dir_switch = "-L"
tool("cc") {
forward_variables_from(concurrent_jobs.goma, "*")
depfile = "{{output}}.d"
command = "$cc -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} -c {{source}} -o {{output}}"
command_launcher = compiler_prefix
depsformat = "gcc"
description = "CC {{output}}"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_file_part}}.o" ]
}
tool("cxx") {
forward_variables_from(concurrent_jobs.goma, "*")
depfile = "{{output}}.d"
command = "$cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} -c {{source}} -o {{output}}"
command_launcher = compiler_prefix
depsformat = "gcc"
description = "CXX {{output}}"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_file_part}}.o" ]
}
tool("asm") {
forward_variables_from(concurrent_jobs.goma, "*")
depfile = "{{output}}.d"
command = "$cc -MD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} -c {{source}} -o {{output}}"
command_launcher = compiler_prefix
depsformat = "gcc"
description = "ASM {{output}}"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_file_part}}.o" ]
}
tool("objc") {
forward_variables_from(concurrent_jobs.local, "*")
depfile = "{{output}}.d"
command = "$cc -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objc}} -c {{source}} -o {{output}}"
command_launcher = compiler_prefix
depsformat = "gcc"
description = "OBJC {{output}}"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_file_part}}.o" ]
}
tool("objcxx") {
forward_variables_from(concurrent_jobs.local, "*")
depfile = "{{output}}.d"
command = "$cxx -MD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objcc}} -c {{source}} -o {{output}}"
command_launcher = compiler_prefix
depsformat = "gcc"
description = "OBJCXX {{output}}"
outputs =
[ "{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o" ]
}
tool("rust_bin") {
forward_variables_from(concurrent_jobs.local, "*")
outname = "{{target_output_name}}{{output_extension}}"
outfile = "{{output_dir}}/$outname"
depfile = "$outfile.d"
unstripped_outfile = outfile
command = ""
if (use_strip) {
unstripped_outfile = "{{output_dir}}/exe.unstripped/{{target_output_name}}{{output_extension}}"
# TODO: see the comment below
command += "mkdir -p {{output_dir}}/exe.unstripped && "
}
if (invoker.toolchain_cpu == "wasm32") {
# default_output_extension doesn't work on binaries
unstripped_outfile = "$unstripped_outfile.wasm"
}
if (invoker.toolchain_os != "mac") {
if (invoker.toolchain_os == "fuchsia") {
# On Fuchsia, lld is directly used to perform linking
link_map_args = "-C link-args=--Map=\"$unstripped_outfile.map\""
} else {
# On host, clang seems to be used to perform linking
link_map_args = "-C link-args=-Wl,--Map=\"$unstripped_outfile.map\""
}
} else {
# MacOS does not support `--Map` in linker flags
link_map_args = ""
}
# TODO(fxbug.dev/47565): Replacement for rustenv
command += "{{rustenv}} RUST_BACKTRACE=1 $rustc --color=always --crate-name {{crate_name}} {{source}} --crate-type {{crate_type}} --emit=dep-info=$depfile,link -Zdep-info-omit-d-target $link_map_args {{rustflags}} -o \"$unstripped_outfile\" {{rustdeps}} {{externs}}"
command += " && $verify_depfile -t \"{{label}}\" -d $depfile {{sources}}"
description = "RUST {{output}}"
default_output_dir = "{{root_out_dir}}"
outputs = [ outfile ]
if (outfile != unstripped_outfile) {
outputs += [ unstripped_outfile ]
}
if (output_breakpad_syms && invoker.toolchain_os == "fuchsia" &&
host_os != "mac") {
command += " && $dump_syms -r -n \"$breakpad_name\" -o Fuchsia \"$unstripped_outfile\" > \"$outfile.sym\""
outputs += [ "$outfile.sym" ]
}
if (output_gsym && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.gsym" ]
command += " && $gsymutil --convert=\"$unstripped_outfile\" --out-file=\"$outfile.gsym\""
}
if (use_strip) {
if (invoker.toolchain_os == "mac") {
command += " && $strip \"$unstripped_outfile\" -o \"$outfile\""
} else if (invoker.toolchain_os == "fuchsia") {
command +=
" && $strip --strip-sections \"$unstripped_outfile\" \"$outfile\""
} else {
command +=
" && $strip --strip-all \"$unstripped_outfile\" \"$outfile\""
}
if (invoker.toolchain_os != "mac" && invoker.toolchain_os != "win") {
command +=
" && $buildidtool -build-id-dir .build-id" +
" -stamp \"$outfile.build-id.stamp\"" + " -entry \"=$outfile\"" +
" -entry \".debug=$unstripped_outfile\""
}
}
rust_sysroot = "$rust_sysroot"
}
tool("rust_rlib") {
forward_variables_from(concurrent_jobs.local, "*")
depfile = "{{output}}.d"
# TODO(fxbug.dev/47565): Replacement for rustenv
command = "{{rustenv}} RUST_BACKTRACE=1 $rustc --color=always --crate-name {{crate_name}} {{source}} --crate-type {{crate_type}} --emit=dep-info=$depfile,link -Zdep-info-omit-d-target {{rustflags}} -o {{output}} {{rustdeps}} {{externs}}"
command += " && $verify_depfile -t \"{{label}}\" -d $depfile {{sources}}"
description = "RUST {{output}}"
outputs =
[ "{{output_dir}}/lib{{target_output_name}}{{output_extension}}" ]
default_output_dir = "{{target_out_dir}}"
default_output_extension = ".rlib"
rust_sysroot = "$rust_sysroot"
}
tool("rust_staticlib") {
forward_variables_from(concurrent_jobs.local, "*")
depfile = "{{output}}.d"
# TODO(fxbug.dev/47565): Replacement for rustenv
command = "{{rustenv}} RUST_BACKTRACE=1 $rustc --color=always --crate-name {{crate_name}} {{source}} --crate-type {{crate_type}} --emit=dep-info=$depfile,link -Zdep-info-omit-d-target {{rustflags}} -o {{output}} {{rustdeps}} {{externs}}"
command += " && $verify_depfile -t \"{{label}}\" -d $depfile {{sources}}"
description = "RUST {{output}}"
outputs = [ "{{output_dir}}/{{target_output_name}}{{output_extension}}" ]
default_output_dir = "{{target_out_dir}}"
default_output_extension = ".a"
output_prefix = "lib"
rust_sysroot = "$rust_sysroot"
}
tool("rust_cdylib") {
forward_variables_from(concurrent_jobs.local, "*")
depfile = "{{output}}.d"
ld_location_env = ""
if (invoker.toolchain_os != "mac") {
if (invoker.toolchain_os == "fuchsia") {
# On Fuchsia, lld is directly used to perform linking
link_map_args = "-C link-args=--Map=\"{{output}}.map\""
} else if (invoker.toolchain_cpu == "wasm32" && host_os == "linux") {
# TODO(fxbug.dev/56076): Remove need for ld location.
# On WASM builds, rust-lld has trouble finding libLLVM.
# This workaround allows the build to proceed.
# Disable link map args, which also seems to have problems with WASM.
link_map_args = ""
shared_lib_dir =
rebase_path("//prebuilt/third_party/rust/${host_platform}/lib",
root_build_dir)
ld_location_env = "LD_LIBRARY_PATH=\"$shared_lib_dir\""
} else if (invoker.toolchain_cpu == "wasm32" && host_os == "mac") {
# See previous section comment.
# We use the fallback dynamic library path on Mac to ensure we first
# search default locations.
link_map_args = ""
shared_lib_dir =
rebase_path("//prebuilt/third_party/rust/${host_platform}/lib",
root_build_dir)
ld_location_env = "DYLD_FALLBACK_LIBRARY_PATH=\"$shared_lib_dir\""
} else {
# On host, clang seems to be used to perform linking
link_map_args = "-C link-args=-Wl,--Map=\"{{output}}.map\""
}
} else {
# MacOS does not support `--Map` in linker flags
link_map_args = ""
}
# TODO(fxbug.dev/47565): Replacement for rustenv
command = "{{rustenv}} $ld_location_env RUST_BACKTRACE=1 $rustc --color=always --crate-name {{crate_name}} {{source}} --crate-type {{crate_type}} --emit=dep-info=$depfile,link -Zdep-info-omit-d-target $link_map_args {{rustflags}} -o {{output}} {{rustdeps}} {{externs}}"
description = "RUST {{output}}"
outputs = [ "{{output_dir}}/{{target_output_name}}{{output_extension}}" ]
default_output_dir = "{{target_out_dir}}"
if (invoker.toolchain_os == "mac") {
default_output_extension = ".dylib"
} else if (invoker.toolchain_cpu == "wasm32") {
default_output_extension = ".wasm"
} else {
default_output_extension = ".so"
}
output_prefix = "lib"
rust_sysroot = "$rust_sysroot"
}
tool("rust_dylib") {
forward_variables_from(concurrent_jobs.local, "*")
outname = "{{target_output_name}}{{output_extension}}"
outfile = "{{output_dir}}/$outname"
depfile = "$outfile.d"
command = ""
if (use_strip) {
unstripped_outfile = "{{output_dir}}/lib.unstripped/{{target_output_name}}{{output_extension}}"
# TODO: see the comment below
command += "mkdir -p {{output_dir}}/exe.unstripped && "
} else {
unstripped_outfile = outfile
}
if (invoker.toolchain_os != "mac") {
if (invoker.toolchain_os == "fuchsia") {
# On Fuchsia, lld is directly used to perform linking
link_map_args = "-C link-args=--Map=\"$unstripped_outfile.map\""
} else {
# On host, clang seems to be used to perform linking
link_map_args = "-C link-args=-Wl,--Map=\"$unstripped_outfile.map\""
}
} else {
# MacOS does not support `--Map` in linker flags
link_map_args = ""
}
command += "{{rustenv}} RUST_BACKTRACE=1 $rustc --color=always --crate-name {{crate_name}} {{source}} --crate-type {{crate_type}} --emit=dep-info=$depfile,link -Zdep-info-omit-d-target $link_map_args {{rustflags}} -o \"$unstripped_outfile\" {{rustdeps}} {{externs}}"
command += " && $verify_depfile -t \"{{label}}\" -d $depfile {{sources}}"
description = "RUST {{output}}"
default_output_dir = "{{root_out_dir}}"
if (invoker.toolchain_os == "mac") {
default_output_extension = ".dylib"
} else if (invoker.toolchain_cpu == "wasm32") {
default_output_extension = ".wasm"
} else {
default_output_extension = ".so"
}
output_prefix = "lib"
outputs = [ outfile ]
if (outfile != unstripped_outfile) {
outputs += [ unstripped_outfile ]
}
if (output_breakpad_syms && invoker.toolchain_os == "fuchsia") {
command += " && $dump_syms -r -o Fuchsia \"$unstripped_outfile\" > \"$outfile.sym\""
outputs += [ "$outfile.sym" ]
}
if (output_gsym && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.gsym" ]
command += " && $gsymutil --convert=\"$unstripped_outfile\" --out-file=\"$outfile.gsym\""
}
if (use_strip) {
if (invoker.toolchain_os == "mac") {
command += " && $strip -x \"$unstripped_outfile\" -o \"$outfile\""
} else {
command +=
" && $strip --strip-all \"$unstripped_outfile\" \"$outfile\""
}
if (invoker.toolchain_os != "mac" && invoker.toolchain_os != "win") {
command +=
" && $buildidtool -build-id-dir .build-id" +
" -stamp \"$outfile.build-id.stamp\"" + " -entry \"=$outfile\"" +
" -entry \".debug=$unstripped_outfile\""
}
}
rust_sysroot = "$rust_sysroot"
}
tool("rust_macro") {
forward_variables_from(concurrent_jobs.local, "*")
depfile = "{{output}}.d"
# TODO(fxbug.dev/47565): Replacement for rustenv
command = "{{rustenv}} RUST_BACKTRACE=1 $rustc --color=always --crate-name {{crate_name}} {{source}} --crate-type {{crate_type}} --emit=dep-info=$depfile,link -Zdep-info-omit-d-target {{rustflags}} -o {{output}} {{rustdeps}} {{externs}}"
command += " && $verify_depfile -t \"{{label}}\" -d $depfile {{sources}}"
description = "RUST {{output}}"
outputs = [ "{{output_dir}}/{{target_output_name}}{{output_extension}}" ]
default_output_dir = "{{root_out_dir}}"
if (invoker.toolchain_os == "mac") {
default_output_extension = ".dylib"
} else {
default_output_extension = ".so"
}
output_prefix = "lib"
rust_sysroot = "$rust_sysroot"
}
tool("alink") {
forward_variables_from(concurrent_jobs.local, "*")
rspfile = "{{output}}.rsp"
command =
"rm -f {{output}} && $ar {{arflags}} rcsD {{output}} \"@$rspfile\""
description = "AR {{output}}"
rspfile_content = "{{inputs}}"
outputs = [ "{{output_dir}}/{{target_output_name}}{{output_extension}}" ]
default_output_dir = "{{target_out_dir}}"
default_output_extension = ".a"
output_prefix = "lib"
}
tool("solink") {
forward_variables_from(concurrent_jobs.local, "*")
outname = "{{target_output_name}}{{output_extension}}"
outfile = "{{output_dir}}/$outname"
rspfile = "$outfile.rsp"
unstripped_outfile = outfile
if (use_strip) {
unstripped_outfile = "{{output_dir}}/lib.unstripped/{{target_output_name}}{{output_extension}}"
}
if (invoker.toolchain_os == "mac") {
command = "$ld -shared {{ldflags}} -Wl,-install_name,@rpath/\"{{target_output_name}}{{output_extension}}\" -o \"$unstripped_outfile\" -Wl,-filelist,\"$rspfile\" {{solibs}} {{libs}} {{frameworks}}"
rspfile_content = "{{inputs_newline}}"
default_output_extension = ".dylib"
} else {
depfile = "$outfile.d"
depsformat = "gcc"
command = "$ld -shared {{ldflags}} -o \"$unstripped_outfile\" -Wl,--dependency-file=\"$depfile\" -Wl,--Map=\"$unstripped_outfile.map\" -Wl,-soname=\"$outname\" \"@$rspfile\" {{solibs}} {{libs}}"
rspfile_content = "{{inputs}}"
default_output_extension = ".so"
}
description = "SOLINK $outfile"
default_output_dir = "{{root_out_dir}}"
output_prefix = "lib"
outputs = [ outfile ]
if (outfile != unstripped_outfile) {
outputs += [ unstripped_outfile ]
}
if (use_strip) {
if (invoker.toolchain_os == "mac") {
command += " && $strip -x \"$unstripped_outfile\" -o \"$outfile\""
} else {
command +=
" && $strip --strip-all \"$unstripped_outfile\" \"$outfile\""
command +=
" && $buildidtool -build-id-dir .build-id" +
" -stamp \"$outfile.build-id.stamp\"" + " -entry \"=$outfile\"" +
" -entry \".debug=$unstripped_outfile\""
}
}
if (output_breakpad_syms && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.sym" ]
command += " && $dump_syms -r -o Fuchsia \"$unstripped_outfile\" > \"$outfile.sym\""
}
if (output_gsym && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.gsym" ]
command += " && $gsymutil --convert=\"$unstripped_outfile\" --out-file=\"$outfile.gsym\""
}
}
tool("solink_module") {
forward_variables_from(concurrent_jobs.local, "*")
outname = "{{target_output_name}}{{output_extension}}"
outfile = "{{output_dir}}/$outname"
rspfile = "$outfile.rsp"
if (use_strip) {
unstripped_outfile = "{{output_dir}}/lib.unstripped/{{target_output_name}}{{output_extension}}"
} else {
unstripped_outfile = outfile
}
if (invoker.toolchain_os == "mac") {
command = "$ld -shared {{ldflags}} -o \"$unstripped_outfile\" -Wl,-filelist,\"$rspfile\" {{solibs}} {{libs}} {{frameworks}}"
rspfile_content = "{{inputs_newline}}"
default_output_extension = ".dylib"
} else {
depfile = "$outfile.d"
depsformat = "gcc"
command = "$ld -shared {{ldflags}} -o \"$unstripped_outfile\" -Wl,--dependency-file=\"$depfile\" -Wl,--Map=\"$unstripped_outfile.map\" \"@$rspfile\" {{solibs}} {{libs}}"
rspfile_content = "{{inputs}}"
default_output_extension = ".so"
}
if (use_strip) {
if (invoker.toolchain_os == "mac") {
command += " && $strip -x \"$unstripped_outfile\" -o \"$outfile\""
} else {
command +=
" && $strip --strip-all" + " \"$unstripped_outfile\" \"$outfile\""
command +=
" && $buildidtool -build-id-dir .build-id" +
" -stamp \"$outfile.build-id.stamp\"" + " -entry \"=$outfile\"" +
" -entry \".debug=$unstripped_outfile\""
}
}
outputs = []
if (output_breakpad_syms && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.sym" ]
command += " && $dump_syms -r -n \"$breakpad_name\" -o Fuchsia \"$unstripped_outfile\" > \"$outfile.sym\""
}
if (output_gsym && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.gsym" ]
command += " && $gsymutil --convert=\"$unstripped_outfile\" --out-file=\"$outfile.gsym\""
}
description = "SOLINK $outfile"
default_output_dir = "{{root_out_dir}}"
outputs += [ outfile ]
if (outfile != unstripped_outfile) {
outputs += [ unstripped_outfile ]
}
}
tool("link") {
forward_variables_from(concurrent_jobs.local, "*")
outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
rspfile = "$outfile.rsp"
unstripped_outfile = outfile
if (use_strip) {
unstripped_outfile = "{{output_dir}}/exe.unstripped/{{target_output_name}}{{output_extension}}"
}
if (invoker.toolchain_os == "mac") {
command = "$ld {{ldflags}} -o \"$unstripped_outfile\" -Wl,-filelist,\"$rspfile\" {{solibs}} {{libs}} {{frameworks}}"
rspfile_content = "{{inputs_newline}}"
} else {
depfile = "$outfile.d"
depsformat = "gcc"
command = "$ld {{ldflags}} -o \"$unstripped_outfile\" -Wl,--dependency-file=\"$depfile\" -Wl,--Map=\"$unstripped_outfile.map\" -Wl,--start-group \"@$rspfile\" {{solibs}} -Wl,--end-group {{libs}}"
rspfile_content = "{{inputs}}"
}
if (use_strip) {
if (invoker.toolchain_os == "mac") {
command += " && $strip \"$unstripped_outfile\" -o \"$outfile\""
} else if (invoker.toolchain_os == "fuchsia") {
command +=
" && $strip --strip-sections \"$unstripped_outfile\" \"$outfile\""
} else {
command +=
" && $strip --strip-all \"$unstripped_outfile\" \"$outfile\""
}
if (invoker.toolchain_os != "mac") {
command +=
" && $buildidtool -build-id-dir .build-id" +
" -stamp \"$outfile.build-id.stamp\"" + " -entry \"=$outfile\"" +
" -entry \".debug=$unstripped_outfile\""
}
}
outputs = []
if (output_breakpad_syms && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.sym" ]
command += " && $dump_syms -r -n \"$breakpad_name\" -o Fuchsia \"$unstripped_outfile\" > \"$outfile.sym\""
}
if (output_gsym && invoker.toolchain_os == "fuchsia") {
outputs += [ "$outfile.gsym" ]
command += " && $gsymutil --convert=\"$unstripped_outfile\" --out-file=\"$outfile.gsym\""
}
description = "LINK $outfile"
default_output_dir = "{{root_out_dir}}"
outputs += [ outfile ]
if (outfile != unstripped_outfile) {
outputs += [ unstripped_outfile ]
}
}
tool("stamp") {
command = stamp_command
description = stamp_description
}
tool("copy") {
command = copy_command
description = copy_description
}
# When invoking this toolchain not as the default one, these args will be
# passed to the build. They are ignored when this is the default toolchain.
toolchain_args = {
current_cpu = invoker.toolchain_cpu
current_os = invoker.toolchain_os
# These values need to be passed through unchanged.
target_os = target_os
target_cpu = target_cpu
if (defined(invoker.toolchain_args)) {
# The invoker isn't allowed to fiddle with the essential settings.
forward_variables_from(invoker.toolchain_args,
"*",
[
"current_cpu",
"current_os",
"target_os",
"target_cpu",
])
}
}
}
}