Skip to contentSkip to conversation

ref-manual: document new toolchain classes and variables

PATCH In review Antonin Godard 2 participants 2 messages Jul 22, 2025 – Aug 1, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ref-manual: document new toolchain classes and variables

Document the new classes under classes/toolchain as well as PREFERRED_TOOLCHAIN* and TOOLCHAIN variables, which allow selecting the toolchain. For now there's "gcc" and "clang" as available toolchain.

---
Changes in v2:
- Apply corrections/suggestions from Quentin Schulz (thanks!)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
 documentation/ref-manual/classes.rst   | 80 ++++++++++++++++++++++++++++++++++
 documentation/ref-manual/variables.rst | 78 +++++++++++++++++++++++++++++++++
 2 files changed, 158 insertions(+)
documentation/ref-manual/classes.rst +80 -0
index 4705ca3f4..ff41c84a7 100644
@@ -3443,6 +3443,86 @@ This class is not intended to be used directly.
 The :ref:`ref-classes-toolchain-scripts` class provides the scripts used for setting up
 the environment for installed SDKs.
 
+.. _ref-classes-toolchain-clang:
+
+``toolchain/clang``
+===================
+
+The :ref:`ref-classes-toolchain-clang` class defines commands for building
+recipes with Clang/LLVM compiler and utilities.
+
+This class is not meant to be inherited directly. Instead, you should either:
+
+-  set the :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE`
+   or :term:`PREFERRED_TOOLCHAIN_SDK` variables to "clang" from a
+   :term:`Configuration File`. This will make the :ref:`ref-classes-base` class
+   use the :ref:`ref-classes-toolchain-clang` accordingly. All recipes will
+   be built with the Clang/LLVM toolchain, exception be made for recipes that
+   override the value of :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to
+   another value.
+
+-  set :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to "clang" from a recipe
+   when the recipe needs to override the default toolchain set by
+   :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` or
+   :term:`PREFERRED_TOOLCHAIN_SDK`.
+
+.. _ref-classes-toolchain-clang-native:
+
+``toolchain/clang-native``
+==========================
+
+The :ref:`ref-classes-toolchain-clang-native` class defines commands for
+building :ref:`ref-classes-native` recipes with Clang/LLVM compiler and
+utilities independently of the build context.
+
+The :ref:`ref-classes-toolchain-gcc-native` class defines :term:`BUILD_CC`,
+:term:`BUILD_CXX` and other such variables which are rarely used in recipes.
+Exception be made for target recipes that need to use the compiler from the
+build host at some point during the build.
+
+This class should not be inherited directly. It is inherited by the
+:ref:`ref-classes-base` class if :term:`TOOLCHAIN_NATIVE` is set to "clang".
+
+.. _ref-classes-toolchain-gcc:
+
+``toolchain/gcc``
+=================
+
+The :ref:`ref-classes-toolchain-gcc` class defines commands for building
+recipes with GCC/Binutils compiler and utilities.
+
+This class is not meant to be inherited directly. Instead, you should either:
+
+-  set the :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE`
+   or :term:`PREFERRED_TOOLCHAIN_SDK` variables to "gcc" from a
+   :term:`Configuration File`. This will make the :ref:`ref-classes-base` class
+   use the :ref:`ref-classes-toolchain-gcc` accordingly. All recipes will
+   be built with the GCC/Binutils toolchain, exception be made for recipes that
+   override the value of :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to
+   another value.
+
+-  set :term:`TOOLCHAIN` or :term:`TOOLCHAIN_NATIVE` to "gcc" from a recipe
+   when the recipe needs to override the default toolchain set by
+   :term:`PREFERRED_TOOLCHAIN_TARGET`, :term:`PREFERRED_TOOLCHAIN_NATIVE` or
+   :term:`PREFERRED_TOOLCHAIN_SDK`.
+
+.. _ref-classes-toolchain-gcc-native:
+
+``toolchain/gcc-native``
+========================
+
+The :ref:`ref-classes-toolchain-gcc-native` class defines commands for building
+:ref:`ref-classes-native` recipes with GCC/Binutils compiler and utilities
+independently of the build context.
+
+The :ref:`ref-classes-toolchain-gcc-native` class defines :term:`BUILD_CC`,
+:term:`BUILD_CXX` and other such variables which are rarely used in recipes.
+Exception be made for target recipes that need to use the compiler from the build
+host at some point during the build.
+
+This class should not be inherited directly. It is inherited by the
+:ref:`ref-classes-base` class if :term:`TOOLCHAIN_NATIVE` is set to "gcc".
+
 .. _ref-classes-typecheck:
 
 ``typecheck``
documentation/ref-manual/variables.rst +78 -0

96 lines not on this page · raw message

---
base-commit: f9f1c87424d307d2df60024bc448bd6778605cf8
change-id: 20250718-new-toolchain-variables-b92155294976

Best regards,

Signature · 1 line
Antonin Godard <[email protected]>