You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Classify explicit toolchain features into shared and platform-specific groups #84
Each feature belongs to exactly one primary ownership group:
Group
Label
Meaning
S
Shared / common
Identical definition and semantics on both platforms; safe to extract into a shared module without modification.
D
Divergent (shared name, different behaviour)
Present on both platforms under the same name, but the flag content, default-enabled state, or surrounding logic differs. Requires platform-specific variants or parameterisation before extraction.
L
Linux-specific
Only defined in the Linux template.
Q
QNX-specific
Only defined in the QNX template.
E
Consumer-extensible
Injected by consumers via extra_known_features / extra_enabled_features; not intrinsic to either template.
Capability markers
Feature
Group
Default enabled
Notes
no_legacy_features
S
Yes
Identical on both. Disables all Bazel-implicit legacy features; the cornerstone of the explicit-feature contract.
supports_pic
S
Yes
Identical capability marker (no flags) on both.
supports_dynamic_linker
S
Yes
Identical capability marker (no flags) on both.
dbg
S
No (mode-activated)
Identical empty marker on both; activates dbg flag sets in other features.
opt
S
No (mode-activated)
Identical empty marker on both; activates opt flag sets in other features.
supports_fission
L
Yes
Linux only. Declares split-DWARF capability to Bazel.
supports_header_path_normalization
L
Yes
Linux only. Suppresses absolute-path warnings for system headers (no flags; pure capability signal).
Compilation — core flag features
Feature
Group
Default enabled
Notes
unfiltered_compile_flags
S
Yes
Identical on both: redacts __DATE__/__TIME__/__TIMESTAMP__ and -Wno-builtin-macro-redefined. Applied to C and C++ compile actions.
random_seed
S
Yes
Identical on both: -frandom-seed=%{output_file} on c_compile, cpp_compile, cpp_module_compile, cpp_module_codegen.
include_paths
S
Yes
Identical on both: -iquote, -I, -isystem from the corresponding build variables across all compile actions.
preprocessor_defines
S
Yes
Identical on both: -D%{preprocessor_defines} across all compile actions.
user_compile_flags
S
Yes
Identical on both: passes user_compile_flags build variable through all compile actions.
compiler_input_flags
S
Yes
Identical on both: -c %{source_file} across all compile actions.
compiler_output_flags
S
Yes
Identical on both: -S / -E / -o %{output_file} across all compile actions.
pic
S
Yes
Identical on both: -fPIC guarded by expand_if_available = "pic" across assemble, preprocess_assemble, c_compile, cpp_compile, cpp_module_codegen, cpp_module_compile.
default_compile_flags
D
Yes
Same role on both; flag content and logic differ: Linux applies arch-specific (-m64 / ARM64) flags, a gnu11-conditional C standard switch (-std=c11 vs -std=gnu11), and a broad set of hardening flags (-fstack-protector, -fno-omit-frame-pointer, etc.). QNX applies -V%{tc_version},gcc_nto%{tc_cpu} for QCC version routing, -std=c11 unconditionally via DEFAULT_C_COMPILE_FLAGS, and a much shorter default flag list. dbg/opt activation logic is structurally identical across both.
compiler_library_search_paths
L
Controlled by %{compiler_library_search_paths_switch}
Linux only. Sets LD_LIBRARY_PATH so that the GCC binary finds its own shared-library dependencies at compile time. Not needed for QNX's QCC, which manages its own library paths internally.
gnu11
L
No
Linux only. Opt-in toggle that switches the C standard from -std=c11 (the default) to -std=gnu11 inside default_compile_flags. QNX uses a fixed -std=c11 via DEFAULT_C_COMPILE_FLAGS with no equivalent toggle.
includes
L
Yes
Linux only. Emits -include %{includes} for force-included headers. Present in the legacy-feature set that Linux restores explicitly; not defined in the QNX template.
per_object_debug_info
L
Yes (guarded)
Linux only. Emits -gsplit-dwarf -g only when per_object_debug_info_file is available (i.e., under --fission). No-op for normal builds.
dependency_file
D
Yes
Present on both; flag syntax differs materially. Linux emits standard -MD -MF %{dependency_file}. QNX wraps the flags for QCC: -Wc,-MD,%{dependency_file} / -Wp,-MD,%{dependency_file}, and the feature is additionally gated by the dependency_file_named_implicitly toggle. Sharing requires either parameterisation or platform-specific implementations.
dependency_file_named_implicitly
Q
No
QNX only. A secondary gating feature that switches dependency_file between explicit-name and implicit-name modes — a QCC-specific behaviour with no Linux counterpart.
Linking and archiving
Feature
Group
Default enabled
Notes
archiver_flags
S
Yes
Identical on both: rcsD %{output_execpath} plus object-file iteration and user_archiver_flags passthrough for cpp_link_static_library.
user_link_flags
S
Yes
Identical on both: passes user_link_flags build variable through all link actions.
linker_param_file
S
Yes
Identical on both: @%{linker_param_file} across all link and static-archive actions.
library_search_directories
S
Yes
Identical on both: -L%{library_search_directories} across all link actions.
shared_flag
S
Yes
Identical on both: -shared for cpp_link_dynamic_library and cpp_link_nodeps_dynamic_library.
output_execpath_flags
S
Yes
Identical on both: -o %{output_execpath} across all link actions.
libraries_to_link
S
Yes
Identical on both: handles whole-archive, non-whole-archive static, object-file, object-file-group, dynamic, and versioned-dynamic library linking through the libraries_to_link build variable.
runtime_library_search_directories
D
Yes
Present on both; rpath logic differs. Linux forks on is_cc_test: $ORIGIN/… for tests, $EXEC_ORIGIN/… for non-tests. QNX always uses $EXEC_ORIGIN/… (no test fork) and uses -Wl,-rpath wrapping as required by QCC.
default_link_flags
D
Yes (always on QNX; conditionally disabled on Linux when extra_link_flags is active)
Same role; flags differ completely. Linux links -lm -ldl -lrt -static-libstdc++ -static-libgcc, adds -Wl,--gc-sections under opt, and adds -Wl,--compress-debug-sections=zlib in non-opt builds. QNX prepends -V%{tc_version},gcc_nto%{tc_cpu}_cxx for QCC version routing and links -Wl,-z,relro -Wl,-z,now -lc++ -lm. Additionally, on Linux default_link_flags is mutually exclusive with extra_link_flags (one disables the other), whereas on QNX extra_link_flagsimpliesdefault_link_flags (both are additive).
sysroot_link_flags
L
Yes (no-op when no sysroot is configured)
Linux only. Injects --sysroot= / -Wl,--sysroot= at link. QNX uses an SDP host/target directory scheme (sdp_env) rather than a sysroot.
use_pthread
L
Yes
Linux only. Links with -pthread. QNX's threading is bundled into libc and requires no separate linker flag.
fission_support
L
Yes (guarded)
Linux only. Emits -Wl,--gdb-index only when is_using_fission is available (i.e., under --fission). No-op for normal builds.
linkstamps
L
Yes (guarded)
Linux only. Passes %{linkstamp_paths} objects to the linker; only populated under --stamp. No-op otherwise.
force_pic_flags
L
Yes (guarded)
Linux only. Emits -pie for cpp_link_executable only when force_pic is available (i.e., under --force_pic). No-op otherwise.
strip_debug_symbols
L
Yes (guarded)
Linux only. Emits -Wl,-S only when strip_debug_symbols is available (build mode active). No-op otherwise.
static_libgcc
L
Yes (guarded)
Linux only. Emits -static-libgcc only when the static_link_cpp_runtimes feature is also active. No-op otherwise.
fully_static_link
L
No (opt-in)
Linux only. Emits -static unconditionally for all link actions when enabled — intentionally disabled by default because it forces fully static linking for every target. Users must enable explicitly.
Present on both; default-enabled state and flag content differ. Linux ships a broad baseline (-Wall, -Wcast-align, -Wformat=2, dozens more). QNX ships a minimal set (-Wall, -Wno-error=deprecated-declarations, one GCC-12.2-specific suppression) and enables it by default. Not safe to share without parameterisation.
strict_warnings
D
No
Both have implies = ["minimal_warnings"] and enabled = False. Linux adds a significant set of strict flags (-Wconversion, -Wpedantic, -Wextra, etc.). QNX adds only -Wextra -Wpedantic. Structure is shareable; flag content is platform-specific.
all_wall_warnings
D
No
Both have implies = ["strict_warnings"] and enabled = False. Linux defines a comprehensive set of ~60 flags. QNX defines an empty set (all three ALL_WALL_* groups are []). Structurally shareable but semantically Linux-only content; sharing would require platform-specific flag injection.
warnings_as_errors
D
No
Present on both; flag content differs. Linux emits -Werror -Wno-error=deprecated-declarations. QNX emits only -Werror. Structurally identical; flag lists are platform-specific.
Coverage
This we will just leave it as it is by now, some stuff here still need clarification
Feature
Group
Default enabled
Notes
coverage
S
No (mode-activated)
Identical empty marker on both; activates coverage flag sets in gcc_coverage_map_format.
gcc_coverage_map_format
D
No
Present on both; link-side flag differs. Compile-side is identical (-fprofile-arcs -ftest-coverage guarded by gcov_gcno_file). Link-side: Linux emits --coverage; QNX emits -lgcov. Both requires = [feature_set(features = ["coverage"])]. Extractable only with a platform-specific link flag parameter.
Present on both; Linux adds implies = ["default_compile_flags"]; QNX also has implies = ["default_compile_flags"]. Structurally similar; Linux additionally provides the split variants below.
extra_c_compile_flags
L
Controlled by %{extra_c_compile_flags_switch}
Linux only. Applies extra flags to C compile actions only. QNX has no equivalent granularity; its extra_compile_flags covers all compile actions.
extra_cxx_compile_flags
L
Controlled by %{extra_cxx_compile_flags_switch}
Linux only. Applies extra flags to C++ compile actions only. QNX has no equivalent granularity.
extra_link_flags
D
Controlled by %{extra_link_flags_switch}
Present on both; mutual-exclusion logic differs. Linux: enabling extra_link_flags disables default_link_flags (only one active at a time). QNX: extra_link_flags implies default_link_flags (additive).
QNX environment
Feature
Group
Default enabled
Notes
sdp_env
Q
Yes
QNX only. Injects QNX_HOST, QNX_TARGET, QNX_CONFIGURATION_EXCLUSIVE, and QNX_SHARED_LICENSE_FILE environment variables into all compile and link actions. No Linux counterpart; Linux tools find their dependencies via rpath and LD_LIBRARY_PATH.
qnx_license_env_info
Q
Controlled by %{use_license_info}
QNX only. Conditionally injects a license environment variable (key and value from template placeholders) into compile and link actions. Activated when the SDP requires a license server.
Consumer-extensible
We will leave this as it is by now.
Mechanism
Group
Notes
extra_known_features attribute
E
Zero or more cc_feature labels passed to the rule. Each is added to the feature list in a disabled state. Consumers can activate them per target via features = [...] or globally via --features. Identical mechanism on both platforms.
extra_enabled_features attribute
E
Zero or more cc_feature labels passed to the rule. Each is added to the feature list in an enabled state. Identical mechanism on both platforms.
Activity
cc_featurecomposition #83armando-martins commentedon Jul 22, 2026
Classification groups
Each feature belongs to exactly one primary ownership group:
extra_known_features/extra_enabled_features; not intrinsic to either template.Capability markers
no_legacy_featuressupports_picsupports_dynamic_linkerdbgdbgflag sets in other features.optoptflag sets in other features.supports_fissionsupports_header_path_normalizationCompilation — core flag features
unfiltered_compile_flags__DATE__/__TIME__/__TIMESTAMP__and-Wno-builtin-macro-redefined. Applied to C and C++ compile actions.random_seed-frandom-seed=%{output_file}on c_compile, cpp_compile, cpp_module_compile, cpp_module_codegen.include_paths-iquote,-I,-isystemfrom the corresponding build variables across all compile actions.preprocessor_defines-D%{preprocessor_defines}across all compile actions.user_compile_flagsuser_compile_flagsbuild variable through all compile actions.compiler_input_flags-c %{source_file}across all compile actions.compiler_output_flags-S/-E/-o %{output_file}across all compile actions.pic-fPICguarded byexpand_if_available = "pic"across assemble, preprocess_assemble, c_compile, cpp_compile, cpp_module_codegen, cpp_module_compile.default_compile_flags-m64/ ARM64) flags, agnu11-conditional C standard switch (-std=c11vs-std=gnu11), and a broad set of hardening flags (-fstack-protector,-fno-omit-frame-pointer, etc.). QNX applies-V%{tc_version},gcc_nto%{tc_cpu}for QCC version routing,-std=c11unconditionally viaDEFAULT_C_COMPILE_FLAGS, and a much shorter default flag list.dbg/optactivation logic is structurally identical across both.compiler_library_search_paths%{compiler_library_search_paths_switch}LD_LIBRARY_PATHso that the GCC binary finds its own shared-library dependencies at compile time. Not needed for QNX's QCC, which manages its own library paths internally.gnu11-std=c11(the default) to-std=gnu11insidedefault_compile_flags. QNX uses a fixed-std=c11viaDEFAULT_C_COMPILE_FLAGSwith no equivalent toggle.includes-include %{includes}for force-included headers. Present in the legacy-feature set that Linux restores explicitly; not defined in the QNX template.per_object_debug_info-gsplit-dwarf -gonly whenper_object_debug_info_fileis available (i.e., under--fission). No-op for normal builds.dependency_file-MD -MF %{dependency_file}. QNX wraps the flags for QCC:-Wc,-MD,%{dependency_file}/-Wp,-MD,%{dependency_file}, and the feature is additionally gated by thedependency_file_named_implicitlytoggle. Sharing requires either parameterisation or platform-specific implementations.dependency_file_named_implicitlydependency_filebetween explicit-name and implicit-name modes — a QCC-specific behaviour with no Linux counterpart.Linking and archiving
archiver_flagsrcsD %{output_execpath}plus object-file iteration anduser_archiver_flagspassthrough forcpp_link_static_library.user_link_flagsuser_link_flagsbuild variable through all link actions.linker_param_file@%{linker_param_file}across all link and static-archive actions.library_search_directories-L%{library_search_directories}across all link actions.shared_flag-sharedforcpp_link_dynamic_libraryandcpp_link_nodeps_dynamic_library.output_execpath_flags-o %{output_execpath}across all link actions.libraries_to_linklibraries_to_linkbuild variable.runtime_library_search_directoriesis_cc_test:$ORIGIN/…for tests,$EXEC_ORIGIN/…for non-tests. QNX always uses$EXEC_ORIGIN/…(no test fork) and uses-Wl,-rpathwrapping as required by QCC.default_link_flagsextra_link_flagsis active)-lm -ldl -lrt -static-libstdc++ -static-libgcc, adds-Wl,--gc-sectionsunderopt, and adds-Wl,--compress-debug-sections=zlibin non-opt builds. QNX prepends-V%{tc_version},gcc_nto%{tc_cpu}_cxxfor QCC version routing and links-Wl,-z,relro -Wl,-z,now -lc++ -lm. Additionally, on Linuxdefault_link_flagsis mutually exclusive withextra_link_flags(one disables the other), whereas on QNXextra_link_flagsimpliesdefault_link_flags(both are additive).sysroot_link_flags--sysroot=/-Wl,--sysroot=at link. QNX uses an SDP host/target directory scheme (sdp_env) rather than a sysroot.use_pthread-pthread. QNX's threading is bundled intolibcand requires no separate linker flag.fission_support-Wl,--gdb-indexonly whenis_using_fissionis available (i.e., under--fission). No-op for normal builds.linkstamps%{linkstamp_paths}objects to the linker; only populated under--stamp. No-op otherwise.force_pic_flags-pieforcpp_link_executableonly whenforce_picis available (i.e., under--force_pic). No-op otherwise.strip_debug_symbols-Wl,-Sonly whenstrip_debug_symbolsis available (build mode active). No-op otherwise.static_libgcc-static-libgcconly when thestatic_link_cpp_runtimesfeature is also active. No-op otherwise.fully_static_link-staticunconditionally for all link actions when enabled — intentionally disabled by default because it forces fully static linking for every target. Users must enable explicitly.Warnings
minimal_warnings-Wall,-Wcast-align,-Wformat=2, dozens more). QNX ships a minimal set (-Wall,-Wno-error=deprecated-declarations, one GCC-12.2-specific suppression) and enables it by default. Not safe to share without parameterisation.strict_warningsimplies = ["minimal_warnings"]andenabled = False. Linux adds a significant set of strict flags (-Wconversion,-Wpedantic,-Wextra, etc.). QNX adds only-Wextra -Wpedantic. Structure is shareable; flag content is platform-specific.all_wall_warningsimplies = ["strict_warnings"]andenabled = False. Linux defines a comprehensive set of ~60 flags. QNX defines an empty set (all threeALL_WALL_*groups are[]). Structurally shareable but semantically Linux-only content; sharing would require platform-specific flag injection.warnings_as_errors-Werror -Wno-error=deprecated-declarations. QNX emits only-Werror. Structurally identical; flag lists are platform-specific.Coverage
coveragegcc_coverage_map_format.gcc_coverage_map_format-fprofile-arcs -ftest-coverageguarded bygcov_gcno_file). Link-side: Linux emits--coverage; QNX emits-lgcov. Bothrequires = [feature_set(features = ["coverage"])]. Extractable only with a platform-specific link flag parameter.Extra flag hooks
extra_compile_flags%{extra_compile_flags_switch}implies = ["default_compile_flags"]; QNX also hasimplies = ["default_compile_flags"]. Structurally similar; Linux additionally provides the split variants below.extra_c_compile_flags%{extra_c_compile_flags_switch}extra_compile_flagscovers all compile actions.extra_cxx_compile_flags%{extra_cxx_compile_flags_switch}extra_link_flags%{extra_link_flags_switch}extra_link_flagsdisablesdefault_link_flags(only one active at a time). QNX:extra_link_flagsimpliesdefault_link_flags(additive).QNX environment
sdp_envQNX_HOST,QNX_TARGET,QNX_CONFIGURATION_EXCLUSIVE, andQNX_SHARED_LICENSE_FILEenvironment variables into all compile and link actions. No Linux counterpart; Linux tools find their dependencies viarpathandLD_LIBRARY_PATH.qnx_license_env_info%{use_license_info}Consumer-extensible
extra_known_featuresattributecc_featurelabels passed to the rule. Each is added to the feature list in a disabled state. Consumers can activate them per target viafeatures = [...]or globally via--features. Identical mechanism on both platforms.extra_enabled_featuresattributecc_featurelabels passed to the rule. Each is added to the feature list in an enabled state. Identical mechanism on both platforms.nradakovic commentedon Aug 13, 2026
Done as part of this ticket thread.