Skip to content

Classify explicit toolchain features into shared and platform-specific groups #84

Closed

Description

@nradakovic

What

Review the current explicit C++ toolchain feature model and classify each feature into one of the following groups:

  • shared/common across Linux and QNX
  • Linux-specific
  • QNX-specific
  • consumer-extensible via extra_known_features / extra_enabled_features

This task establishes the architectural boundary needed for the refactoring Epic.

Acceptance Criteria (DoD)

  • A documented classification exists for all explicitly modeled toolchain features.
  • Each feature is assigned to exactly one primary ownership group.
  • The classification identifies which features are safe to share and which must remain platform-specific.
  • The result is detailed enough to guide follow-up extraction and refactoring tasks.

How

  • Review the current Linux and QNX toolchain templates.
  • Enumerate explicitly defined features and note their purpose, enabled state, and action coverage.
  • Compare Linux and QNX feature behavior to identify true overlap versus superficial similarity.
  • Record the final classification in a maintainer-facing design note or tracking document.

Activity

  1. self-assigned this
    on Jul 2, 2026
  2. added theissue type on Jul 2, 2026
  3. armando-martins commented on Jul 22, 2026

    @armando-martins
    Contributor

    Classification groups

    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_flags implies default_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.

    Warnings

    Feature Group Default enabled Notes
    minimal_warnings D No on Linux; Yes on QNX 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.

    Extra flag hooks

    Feature Group Default enabled Notes
    extra_compile_flags D Controlled by %{extra_compile_flags_switch} 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.
  4. added
    featureNew feature request
    p1Critical/High - system down/major feature broken - demanding immediate action
    p3Medium/Low - handle it within normal process
    and removed
    p1Critical/High - system down/major feature broken - demanding immediate action
    on Aug 13, 2026
  5. nradakovic commented on Aug 13, 2026

    @nradakovic
    MemberAuthor

    Done as part of this ticket thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

featureNew feature requestp3Medium/Low - handle it within normal process

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions