blob: 4a12064adb226d4637b79130290bc6c50aa47555 [file] [log] [blame]
load(":cc_toolchain_config.bzl", "host_cc_toolchain_config")
# Toolchain definitions.
#
# We currently define two toolchains:
#
# - //build/toolchain:host_cc_toolchain , which points to our hermetic sandbox
# sysroot default compiler toolchain. It is mainly used to target the execution platform
# inside the sandbox (i.e. build tooling).
# - //build/toolchain/musl-host-gcc:musl_host_toolchain , which combines the sandbox sysroot
# gcc compiler with a sysroot tarball that targets the Metropolis node
# runtime. This can be used to build C libraries/tools running within the
# Metropolis node image or on the (unknown) host operating system outside the sandbox.
# This file defines //build/toolchain:host_cc_toolchain.
#
# This is a C++ toolchain that uses GCC from the sandbox sysroot at hardcoded paths. We
# can get away with this, as currently the entire build is performed in a hermetic
# sandbox sysroot (see: //third_party/sandboxroot). We define this toolchain so
# that we have full control over all configuration of it, which we need as we
# are building some fairly odd C binaries (notably, a qboot bootloader for
# testing).
#
# The host_cc toolchain suite is enabled for all cc_* targets whose
# platform isn't matching a more specific toolchain.
#
# This, and :cc_toolchain_config.bzl is based on the following tutorial:
# https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html
package(default_visibility = ["//visibility:public"])
filegroup(name = "empty")
cc_toolchain(
name = "host_cc_k8_toolchain",
all_files = ":empty",
ar_files = ":empty",
as_files = ":empty",
compiler_files = ":empty",
dwp_files = ":empty",
linker_files = ":empty",
objcopy_files = ":empty",
strip_files = ":empty",
supports_param_files = 0,
toolchain_config = ":host_cc_k8_toolchain_config",
toolchain_identifier = "host-k8-toolchain",
)
host_cc_toolchain_config(name = "host_cc_k8_toolchain_config")
toolchain(
name = "host_cc_toolchain",
exec_compatible_with = [
"@bazel_tools//platforms:linux",
"@bazel_tools//platforms:x86_64",
],
target_compatible_with = [
"@bazel_tools//platforms:linux",
"@bazel_tools//platforms:x86_64",
],
toolchain = ":host_cc_k8_toolchain",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)