Adding support for a new toolchain variant usually touches several layers:
- add or extend package metadata in
packages/version_matrix.bzl, - add a package BUILD descriptor under
packages/linux/orpackages/qnx/, - ensure the required template placeholders already exist, or extend the platform template files,
- update the test workspace under
tests/if the new variant should be validated by the test matrix (add a matching--configentry intests/.bazelrc), - add or update documentation in this Markdown source and the repository README.
Use the version matrix when a package should be part of the supported default surface for consumers. This gives downstream users a shorter configuration and centralizes special sysroot flags in one place.
Use explicit gcc.sdp(...) declarations when package metadata is local,
experimental, or intentionally not part of the default support matrix.
Both the Linux and QNX toolchain configs enable no_legacy_features, so
Bazel injects nothing implicitly — every compile/link/archive flag must come
from a feature (or wiring) declared in the template. See
docs/features.md for the full feature list. Not everything is a
feature, though; some behavior is provided by other toolchain wiring:
- Compiler / archiver / strip tools are bound through
action_configentries (assemble,c_compile,cpp_compile, the link actions, andcpp_link_static_library), nottool_paths. The static-library actionimplies = ["archiver_flags"], so thearchiver_flagsfeature only supplies the flags while theaction_configsupplies thearbinary. gcovis provided viatool_paths(gcov_wrapper).- Sysroot (Linux) — the sysroot path is passed as
builtin_sysroottocreate_cc_toolchain_config_info; compile-time header resolution relies oncxx_builtin_include_directories, so no--sysrootis needed at compile. Link-time--sysroot/-Wl,--sysrootis emitted by the customsysroot_link_flagsfeature. There is intentionally no legacysysrootcompile feature. - Sysroot / system includes (QNX) — QNX does not use
builtin_sysroot; system include roots come fromcxx_builtin_include_directories(SDP paths), and the SDP environment is injected by thesdp_envfeature.
When adding or auditing a feature, classify how each required behavior is
provided: an explicit feature in the features list, tool/sysroot wiring
as above, or flags baked into another feature (e.g. -fPIC is an explicit
pic feature on Linux but part of default_compile_flags on QNX). Under
no_legacy_features nothing is supplied automatically, so a missing behavior
means a broken build rather than a silent fallback.
Static archives:
fully_static_link(-static) requires static system libraries (libc.a,libstdc++.a, ...). Toolchains that ship only shared libraries (e.g. AutoSD) cannot link fully static binaries, so that feature is opt-in and its test is marked incompatible with such platforms.
- runtime-specific toolchains may need extra include and link flags that do not exist for standard GCC archives,
- QNX
aarch64naming differs from some underlying SDK paths, - QNX licensing and authentication requirements live outside Bazel target analysis and must be configured in the execution environment,
- documentation examples must stay aligned with actual
tests/.bazelrcconfiguration names.
For repository changes that affect toolchain resolution, package metadata, or
template generation, validate with the test workspace (a separate Bazel
workspace, so run the commands from tests/):
cd tests
bazel test --config x86_64-linux //...
bazel test --config x86_64-linux //:feature_verification_tests
bazel test --config x86_64-linux //:language_and_standards_testsThe available --config values (for example x86_64-linux, aarch64-linux,
x86_64-qnx, aarch64-qnx, x86_64-linux-autosd10, aarch64-linux-ebclfsa)
are defined in tests/.bazelrc.
For documentation-only changes, build or preview the Markdown site to catch markup and table-of-contents/navigation issues before publishing.