From: "mark.yang" <[email protected]>

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(-)

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#240415): 
https://lists.openembedded.org/g/openembedded-core/message/240415
Mute This Topic: https://lists.openembedded.org/mt/120168206/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to