All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][PATCH 0/3] kernel: make the kernel toolchain switchable to clang
@ 2026-07-08  2:28 mark.yang
  2026-07-08  2:28 ` [OE-core][PATCH 1/3] module.bbclass/make-mod-scripts: inhibit default dependencies mark.yang
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: mark.yang @ 2026-07-08  2:28 UTC (permalink / raw)
  To: openembedded-core; +Cc: mark.yang

From: "mark.yang" <mark.yang@lge.com>

Building the kernel with clang currently means overriding TOOLCHAIN and
the KERNEL_* variables in a bbappend. The kernel builds, but modules and
make-mod-scripts keep the gcc defaults and run the shared kernel build
tree with the other compiler. kbuild then re-runs syncconfig against the
shared .config and silently drops compiler-dependent options: a
CONFIG_CFI_CLANG kernel loses kCFI as soon as any module is built.
Documentation/kbuild/llvm.rst requires the same toolchain for every make
invocation against one tree.

This series adds a KERNEL_TOOLCHAIN switch so the kernel, modules and
make-mod-scripts move to clang together. gcc remains the default.

Tested on qemux86-64 with clang and gcc: both toolchains
build linux-yocto, make-mod-scripts and cryptodev-module, the shared
.config stays consistent across module builds (also with ld-is-lld),
and core-image-sato boots.

mark.yang (3):
  module.bbclass/make-mod-scripts: inhibit default dependencies
  kernel-yocto: export CLANG_FLAGS for the kconfiglib config audit
  kernel-arch: add KERNEL_TOOLCHAIN for building the kernel with clang

 meta/classes-recipe/kernel-arch.bbclass             | 13 ++++++++++++-
 meta/classes-recipe/kernel-yocto.bbclass            |  7 +++++++
 meta/classes-recipe/module.bbclass                  |  5 +++++
 .../make-mod-scripts/make-mod-scripts_1.0.bb        |  5 +++++
 4 files changed, 29 insertions(+), 1 deletion(-)



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-07-08  2:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08  2:28 [OE-core][PATCH 0/3] kernel: make the kernel toolchain switchable to clang mark.yang
2026-07-08  2:28 ` [OE-core][PATCH 1/3] module.bbclass/make-mod-scripts: inhibit default dependencies mark.yang
2026-07-08  2:28 ` [OE-core][PATCH 2/3] kernel-yocto: export CLANG_FLAGS for the kconfiglib config audit mark.yang
2026-07-08  2:28 ` [OE-core][PATCH 3/3] kernel-arch: add KERNEL_TOOLCHAIN for building the kernel with clang mark.yang
2026-07-08  2:37 ` [OE-core][PATCH 0/3] kernel: make the kernel toolchain switchable to clang Bruce Ashfield
2026-07-08  2:44   ` [PATCH " mark.yang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.