mbox series

[v2,00/28] clang: Add clang C/C++ toolchain

Message ID 20250520-clang-toolchain-v2-0-db97c2eb3756@gmail.com
Headers show
Series clang: Add clang C/C++ toolchain | expand

Message

Khem Raj May 21, 2025, 6:19 a.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>
---
Changes in v2:
- Move the changed from default-toolchains.inc file into respective recipes
- Drop adding libomp as toolchain-clang dependency for rpm, it will be
  needed when clang is used for rpm, as of now it does not
- Fix musl world builds for qemuarm/qemuarm64/qemuriscv64/qemuriscv32
- Link to v1: https://lore.kernel.org/r/20250518-clang-toolchain-v1-0-5be46f8c4af5@gmail.com

---
Khem Raj (28):
      toolchain: Provide abstraction for choosing per-recipe toolchain
      clang.bbclass: Specify ldso when using usermerge
      vte: Disable gi data generation when using clang on arm
      clang: Add compiler-rt to default deps when using clang compiler
      gnu-efi: Use objcopy from GNU binutils with clang
      tcf-agent: Fix ranlib call when using llvm-ranlib
      pulseaudio: Treat -Wunused-command-line-argument as error
      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
      openssl: Link with libatomic on x86/clang
      qemu: Link with libatomic on x86/clang
      bluez: Disable invalid-pp-token warning with clang
      gcc: Always use GCC toolchain
      glibc: Always use GCC toolchain
      grub,grub-efi: Pin to using gcc on aarch64
      valgrind: Use gcc to compile on riscv64
      syslinux: Pin to using GCC toolchain
      systemtap: Pin to build with GCC
      webkitgtk: Use gcc to compile for arm target
      pseudo: Pin to using GCC compiler
      rpm: Always use gcc compiler
      pulseaudio: Pin to use GCC compiler
      seatd: Disable sign-compare warning as error on clang
      busybox: Fix build on architectures without SYS_settimeofday
      systemd-boot: Use gcc on musl/arm
      perf: Do not treat maybe-uninitialized warnings as errors

 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/recipes-bsp/gnu-efi/gnu-efi_4.0.0.bb          |  4 ++
 meta/recipes-bsp/grub/grub2.inc                    |  4 ++
 meta/recipes-connectivity/bluez5/bluez5.inc        |  1 +
 meta/recipes-connectivity/openssl/openssl_3.5.0.bb |  3 ++
 ...ck-for-SYS_settimeofday-before-calling-sy.patch | 52 ++++++++++++++++++++++
 meta/recipes-core/busybox/busybox_1.37.0.bb        |  1 +
 meta/recipes-core/glibc/glibc-common.inc           |  2 +
 meta/recipes-core/seatd/seatd_0.9.1.bb             |  8 ++++
 meta/recipes-core/systemd/systemd-boot_257.5.bb    |  8 ++++
 meta/recipes-devtools/gcc/gcc-15.1.inc             |  2 +
 meta/recipes-devtools/pseudo/pseudo_git.bb         |  7 +++
 meta/recipes-devtools/qemu/qemu_10.0.0.bb          |  1 +
 meta/recipes-devtools/rpm/rpm_4.20.0.bb            |  4 ++
 .../syslinux/syslinux_6.04-pre2.bb                 |  5 +++
 meta/recipes-devtools/tcf-agent/tcf-agent_git.bb   |  5 +++
 meta/recipes-devtools/valgrind/valgrind_3.25.0.bb  |  8 ++++
 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-kernel/perf/perf.bb                   | 10 +++++
 meta/recipes-kernel/systemtap/systemtap_git.bb     |  4 ++
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc  |  8 ++++
 meta/recipes-sato/webkit/webkitgtk_2.48.1.bb       |  2 +
 meta/recipes-support/vte/vte_0.78.2.bb             |  4 ++
 35 files changed, 216 insertions(+), 9 deletions(-)
---
base-commit: e3402fe00ca5602dbcfd151ab3fd4bfb3371f76c
change-id: 20250518-clang-toolchain-f9a8a0572306

Best regards,