These are the cc_toolchain features defined by the toolchain configs in
templates/linux/cc_toolchain_config.bzl.template
and
templates/qnx/cc_toolchain_config.bzl.template.
Both toolchains enable no_legacy_features, which turns off the features
Bazel would otherwise add implicitly. As a result every flag the toolchain emits
comes from a feature defined explicitly below.
Migrating from an implicit/legacy setup? See the Migration guide for the behavioral impact of
no_legacy_featuresand how to restore supported behavior explicitly.
Each entry is tagged with the platform(s) it applies to: (both), (Linux), or (QNX). Unless noted as opt-in (disabled by default), a feature is enabled by default.
Note: The order of features in the
featureslist is significant — flags from a later feature appear after those from an earlier feature on the command line.
no_legacy_features(both) — Disables Bazel's implicit legacy features.supports_pic(both) — Declares position-independent-code support.supports_dynamic_linker(both) — Declares dynamic-linking support.supports_fission(Linux) — Declares Fission (split DWARF) support.supports_header_path_normalization(Linux) — Suppresses absolute-path warnings for system headers.dbg/opt(both) — Well-known build-mode markers used to select flags.
unfiltered_compile_flags(both) — Redacts__DATE__/__TIME__/__TIMESTAMP__for reproducible builds.default_compile_flags(both) — Core compile flags plusdbg/optbuild-mode variants (exact flags differ per target).pic(Linux) — Emits-fPICwhen thepicbuild variable is available. QNX declares thesupports_piccapability marker but does not add-fPICin the default compile flags.random_seed(both) — Emits-frandom-seed=<output_file>for deterministic output.include_paths(both) — Emits-iquote/-I/-isystemfrom thequote_include_paths,include_paths, andsystem_include_pathsvariables.preprocessor_defines(both) — Emits-Ddefines (fromdefines/local_defines).includes(Linux) — Emits-include <hdr>for force-included headers.user_compile_flags(both) — Passes through user-supplied compile flags (copts).compiler_input_flags(both) —-cand the source file.compiler_output_flags(both) —-S/-E/-ooutput flags.compiler_library_search_paths(Linux) — SetsLD_LIBRARY_PATHso the compiler binary finds its shared libraries.dependency_file(both) — Generates.ddependency files. On QNX,dependency_file_named_implicitlytoggles between explicit and implicit naming.per_object_debug_info(Linux) — Emits-gsplit-dwarf -gunder--fission(guarded; no-op otherwise).
archiver_flags(both) —arflags (rcsD) and the object-file list for static archives.user_link_flags(both) — Passes through user-supplied link flags (linkopts).linker_param_file(both) — Uses@param_filefor linker/archiver args.default_link_flags(both) — Default/hardening link flags (exact flags differ per target and build mode).library_search_directories(both) — Emits-Lsearch paths.runtime_library_search_directories(both) — Emits-Wl,-rpathentries ($ORIGINforcc_test,$EXEC_ORIGINotherwise).shared_flag(both) —-sharedfor dynamic libraries.output_execpath_flags(both) —-ofor the link output.libraries_to_link(both) — Handles whole-archive, static, object-file, dynamic, and versioned-dynamic library linking.sysroot_link_flags(Linux) — Adds--sysroot/-Wl,--sysrootat link.
These mirror Bazel's legacy features and are guarded, so they are no-ops until the relevant build mode is active. All are enabled by default except where noted.
fission_support—-Wl,--gdb-indexunder--fission.linkstamps— Passes%{linkstamp_paths}to the linker (--stamp).force_pic_flags—-piefor executables under--force_pic.strip_debug_symbols—-Wl,-Swhen the link output is stripped (e.g.fastbuild/opt, notdbg).static_libgcc—-static-libgccwhenstatic_link_cpp_runtimesis on.fully_static_link—-staticfor fully static executables. Opt-in (disabled by default), since it forces static linking for every target and requires static system archives (unavailable on some toolchains, e.g. AutoSD).
Opt-in / disabled by default unless noted otherwise.
minimal_warnings(both) — Baseline warning set (includes-Wall). Enabled by default on QNX; opt-in (disabled by default) on Linux.strict_warnings(both) — Stricter warnings; impliesminimal_warnings.all_wall_warnings(Linux) — Broadest warning set; impliesstrict_warnings.warnings_as_errors(both) — Adds-Werror.
sanitizer— Base sanitizer feature.asan/lsan/tsan/ubsan— Address / Leak / Thread / Undefined-Behavior sanitizers; each impliessanitizer.
use_pthread(Linux) — Links with-pthread.
extra_compile_flags(both) — Extra flags for all compile actions.extra_c_compile_flags/extra_cxx_compile_flags(Linux) — Extra C / C++ compile flags.extra_link_flags(both) — Extra link flags.
coverage(both) — Base coverage feature.gcc_coverage_map_format(both) —-fprofile-arcs -ftest-coverageat compile and-lgcov/--coverageat link.
sdp_env(QNX) — Injects QNX SDP environment variables (QNX_HOST,QNX_TARGET, license path, ...) into compile/link actions.qnx_license_env_info(QNX) — Adds an optional license environment entry.