The repository turns a small MODULE.bazel declaration into a generated
toolchain repository through these steps:
extensions/gcc.bzlcollectsgcc.toolchainandgcc.sdptags.- Package metadata is resolved from
packages/version_matrix.bzlor from an explicitgcc.sdpdeclaration. rules/gcc.bzlrenders a BUILD file and configuration files into a new repository.- Platform-specific templates from
templates/linux/ortemplates/qnx/are populated with CPU, version, licensing, and flag information. - The consuming workspace enables the generated toolchain with
--extra_toolchainsand compatible platform constraints.
packages/version_matrix.bzl
Defines the supported package matrix. Each entry maps a logical toolchain key to download metadata and, when needed, extra compiler or linker flags.
rules/common.bzl
Provides small helpers that convert lists of flags into the Bazel flag_group
representation needed by the templates and repository rules.
rules/gcc.bzl
Generates the toolchain repository. It decides whether Linux or QNX template
content is required, performs placeholder substitution, and emits the final
BUILD, cc_toolchain_config.bzl, flags.bzl, and Linux gcov wrapper
files.
Linux templates:
templates/linux/cc_toolchain_config.bzl.templatetemplates/linux/cc_toolchain_flags.bzl.templatetemplates/linux/cc_gcov_wrapper.template
QNX templates:
templates/qnx/cc_toolchain_config.bzl.templatetemplates/qnx/cc_toolchain_flags.bzl.template
Shared template:
templates/BUILD.template
- Some package definitions rely on the
%{toolchain_pkg}%placeholder, which is rewritten to the canonical Bzlmod repository name during repository-rule generation. - QNX
aarch64is mapped internally toaarch64lewhere required by the underlying SDK layout. - SDP version
8.0.4is normalized to8.0.0in the generated toolchain configuration because platform constraint support currently uses the older identifier. - Linux toolchains generate an extra
gcov_wrapperscript to work around the currentrules_cccoverage integration behavior.
The version matrix is more than a list of URLs. It is also the place where the repository centralizes:
- package build-file selection,
- archive extraction prefixes,
- sysroot-specific compiler flags,
- extra link flags,
- compiler library search paths,
- runtime-ecosystem variants such as AutoSD or EB corbos Linux for Safety Applications.