Enable no_legacy_features on the Linux and QNX toolchains#95
Merged
Conversation
bea6bfa to
640636a
Compare
no_legacy_features on the Linux and QNX toolchains
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates the Linux (GCC) and QNX (QCC) Bazel cc_toolchain templates to a fully explicit feature configuration by enabling no_legacy_features, ensuring that compile/link/archive behavior is driven by features declared in the templates rather than Bazel’s legacy feature injection.
Changes:
- Enable
no_legacy_featuresin both Linux and QNX toolchain templates and explicitly add the core compile/link/archive features that were previously implicitly provided. - Add new feature-verification tests (plus a new
opt_in_features/package for manual/build-mode-gated checks) and wire them into the feature verification suite. - Refresh and restructure documentation to reflect the explicit feature set and updated validation/test layout, and update the Linux CI workflow to exercise
--force_pic.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/feature_verification/user_link_flags_test.cpp | Adds runtime/link-failure-based verification for forwarding linkopts via user link flags feature. |
| tests/feature_verification/random_seed_test.cpp | Adds a build-and-run smoke test exercising code patterns affected by -frandom-seed. |
| tests/feature_verification/preprocessor_defines_test.cpp | Adds a compile-time check verifying local_defines are routed via preprocessor_defines. |
| tests/feature_verification/opt_in_features/opt_in_smoke.cpp | Shared smoke-test main for manual opt-in feature targets. |
| tests/feature_verification/opt_in_features/force_pic_test.cpp | Adds a --force_pic verification by asserting PIE (ET_DYN) via ELF header inspection. |
| tests/feature_verification/opt_in_features/BUILD | Introduces manual tests for opt-in/build-mode-gated features. |
| tests/feature_verification/include_dir/custom_math.h | Adds a header used to verify include search paths emitted for includes-exposed directories. |
| tests/feature_verification/include_dir_test.cpp | Adds test verifying includes attribute -> include_paths feature behavior. |
| tests/feature_verification/fully_static_link_test.cpp | Adds runtime verification of fully static linking by scanning /proc/self/maps for .so mappings. |
| tests/feature_verification/BUILD | Wires new feature tests into the feature verification package. |
| tests/BUILD | Adds new feature verification tests into the top-level tests suite. |
| templates/qnx/cc_toolchain_config.bzl.template | Enables no_legacy_features and adds explicit core compile/link/archive features for QNX. |
| templates/linux/cc_toolchain_config.bzl.template | Enables no_legacy_features and adds explicit core + guarded legacy-equivalent features for Linux. |
| README.md | Updates repository documentation links to reflect the new consolidated features documentation. |
| docs/tests_and_validation.md | Updates the description of feature verification coverage and the new opt-in tests package. |
| docs/test_suite.md | Documents the newly added feature verification tests and the opt-in/manual test package. |
| docs/qnx_toolchain_feature_set.md | Removes planning doc now superseded by explicit feature wiring + consolidated features doc. |
| docs/maintenance.md | Adds “Toolchain Feature Wiring” section explaining how non-feature wiring complements no_legacy_features. |
| docs/linux_toolchain_feature_set.md | Removes planning doc now superseded by explicit feature wiring + consolidated features doc. |
| docs/features.md | Adds consolidated documentation for toolchain features across Linux and QNX. |
| .github/workflows/x86_64-linux.yml | Adds a dedicated CI step to exercise the force-PIE behavior under --force_pic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Enable no_legacy_features on the Linux and QNX cc_toolchain configs and explicitly implement every compile, link, and archive feature previously provided by Bazel's legacy machinery, plus guarded legacy features enabled by default (fully_static_link stays opt-in). Also fix include_paths to use the correct build variables (quote_include_paths/include_paths/system_include_paths), which were never populated before and so emitted no -iquote/-I/-isystem flags. resolves #76 #77
Rewrite docs/features.md to reflect the explicit, no_legacy_features-based feature set of both the Linux and QNX toolchains, with per-feature platform tags and default-enabled/opt-in status. Remove the two development/planning documents (linux_toolchain_feature_set.md, qnx_toolchain_feature_set.md) now that the migration they tracked is complete, migrating their still-relevant sysroot and tool-wiring notes into a new "Toolchain Feature Wiring" section in docs/maintenance.md. Update the README to link to features.md instead of the removed documents. resolves #80
Add tests that genuinely exercise the features implemented under no_legacy_features: - preprocessor_defines_test: defines via the local_defines attribute (distinct from copts/user_compile_flags) - include_dir_test: include_paths via a library's `includes` attribute - user_link_flags_test: linkopts forwarded through user_link_flags (--defsym) - random_seed_test: reproducible-build random seed smoke test - fully_static_link_test: verifies a fully static binary maps no shared objects; marked incompatible with toolchains lacking static archives (AutoSD) Add an opt_in_features/ package with manual tests for the disabled-by-default or build-mode-gated features (per_object_debug_info, fission_support, linkstamps, includes, force_pic_flags, strip_debug_symbols, static_libgcc), and a genuine force_pic PIE check run via a dedicated --force_pic CI step. Wire the new tests into //:feature_verification_tests and update the x86_64-linux workflow. Refresh docs/test_suite.md and docs/tests_and_validation.md to list the new tests, the opt_in_features package, and the directory layout. resolves #78
640636a to
626cd09
Compare
This was
linked to
issues
Jul 14, 2026
This was
linked to
issues
Jul 14, 2026
antonkri
previously approved these changes
Jul 15, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nikola Radakovic <radaknikolans@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nikola Radakovic <radaknikolans@gmail.com>
antonkri
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves both the Linux (GCC) and QNX (QCC)
cc_toolchainconfigs to an explicit,no_legacy_features-based configuration. With legacy feature injection disabled, every compile, link, and archive flag is now supplied by a feature defined in the templates. Adds test coverage for the newly explicit features and refreshes the documentation.Toolchain changes
no_legacy_featureson both templates and explicitly implement every compile, link, and archive feature previously provided by Bazel's legacy machinery.per_object_debug_info,fission_support,linkstamps,includes,force_pic_flags,strip_debug_symbols,static_libgcc.fully_static_linkstays opt-in since it emits-staticunconditionally.include_pathsto use the correct build variables (quote_include_paths/include_paths/system_include_paths); the previous*_include_directoriesnames were never populated, so no-iquote/-I/-isystemflags were emitted.Tests
preprocessor_defines_test(local_defines),include_dir_test(theincludesattribute),user_link_flags_test(linkopts/--defsym),random_seed_test, andfully_static_link_test(verifies no shared objects are mapped; marked incompatible with toolchains lacking static archives, e.g. AutoSD).opt_in_features/package with manual tests for the disabled-by-default / build-mode-gated features, plus a genuine force-PIC check run in a dedicated--force_picCI step.//:feature_verification_testsand update thex86_64-linuxworkflow.Documentation
docs/features.mdto reflect the explicit feature set, with per-feature platform tags and default-enabled/opt-in status.linux_toolchain_feature_set.md,qnx_toolchain_feature_set.md), migrating their sysroot and tool-wiring notes into a new "Toolchain Feature Wiring" section indocs/maintenance.md; update the README accordingly.docs/test_suite.mdanddocs/tests_and_validation.mdfor the new tests and layout.Resolves #76 #77 #78 #79 #80