mbox series

[00/21] clang: Add clang C/C++ toolchain

Message ID 20250518-clang-toolchain-v1-0-5be46f8c4af5@gmail.com
Headers show
Series clang: Add clang C/C++ toolchain | expand

Message

Khem Raj May 18, 2025, 9:30 p.m. UTC
Clang also provided a full fledged C/C++ cross compiler which is
capable of building any C/C++ components.

A mechanism is added to select the toolchain using

TOOLCHAIN = "clang"

in config metadata. This will also add an entry into OVERRIDES
'toolchain-<COMPILER>', e.g. toolchain-clang which can be used
to define clang-specific aspects in metadata.

All packages are not full buildable with clang, e.g. glibc which
rely on some extentions which are only available in gcc. Such
exceptions are made in config metadata using a global file called

meta/conf/distro/include/default-toolchain.inc

This file can be added in every layer to define these details themselves
bitbake will include all such files auotmaticlally.

Defaults are kept as it is, nothing is expected to change if its not
enabled

World builds for qemuarm/qemuarm64/qemuppc/qemumips/qemux86_64
are successful with some exceptions

vulkan-samples - qemuarm64/qemux86-64
bluez - qemuppc
compiler-rt-sanitizers - qemumips

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
Khem Raj (21):
      toolchain: Provide abstraction for choosing per-recipe toolchain
      default-toolchains.inc: Add a global file to pin TOOLCHAIN variable
      clang.bbclass: Specify ldso when using usermerge
      pulseaudio: Pin to use GCC compiler
      vte: Disable gi data generation when using clang on arm
      rpm: Add openmp dependency when using clang
      clang: Add compiler-rt to default deps when using clang compiler
      rpm: Always use gcc compiler
      pseudo: Pin to using GCC compiler
      webkitgtk: Use gcc to compile for arm target
      gnu-efi: Use objcopy from GNU binutils with clang
      tcf-agent: Fix ranlib call when using llvm-ranlib
      systemtap: Pin to build with GCC
      valgrind: Use gcc to compile on riscv64
      pulseaudio: Treat -Wunused-command-line-argument as error
      syslinux: Pin to using GCC toolchain
      libjpeg-turbo: Fix build on mips/clang
      pixman: Fix build with mips/clang
      systemd-boot: Remove -mfpmath=sse option from cflags
      vulkan-samples: Disable overriding-option as error
      grub,grub-efi: Pin to using gcc on aarch64

 meta/classes-global/base.bbclass                   |  5 ++
 meta/classes-recipe/cross-canadian.bbclass         |  2 +
 meta/classes-recipe/cross.bbclass                  |  2 +
 meta/classes-recipe/crosssdk.bbclass               |  2 +
 meta/classes-recipe/native.bbclass                 |  2 +
 meta/classes-recipe/nativesdk.bbclass              |  2 +
 meta/classes/clang-native.bbclass                  | 28 +++++++++++
 .../toolchain/clang.inc => classes/clang.bbclass}  | 17 +++++--
 .../build-gcc.inc => classes/gcc-native.bbclass}   |  1 -
 .../toolchain/gcc.inc => classes/gcc.bbclass}      |  1 +
 meta/conf/bitbake.conf                             |  7 ++-
 meta/conf/distro/defaultsetup.conf                 |  1 +
 meta/conf/distro/include/default-toolchains.inc    | 55 ++++++++++++++++++++++
 meta/recipes-bsp/gnu-efi/gnu-efi_4.0.0.bb          |  4 ++
 meta/recipes-core/systemd/systemd-boot_257.5.bb    |  5 ++
 meta/recipes-devtools/rpm/rpm_4.20.0.bb            |  1 +
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |  5 ++
 meta/recipes-graphics/jpeg/libjpeg-turbo_3.1.0.bb  |  6 +++
 meta/recipes-graphics/vulkan/vulkan-samples_git.bb |  4 ++
 meta/recipes-graphics/xorg-lib/pixman_0.46.0.bb    |  3 ++
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc  |  3 ++
 meta/recipes-support/vte/vte_0.78.2.bb             |  4 ++
 22 files changed, 151 insertions(+), 9 deletions(-)
---
base-commit: e3d24e5cd8eee5d0d232abdfef33cacf0ad96787
change-id: 20250518-clang-toolchain-f9a8a0572306

Best regards,