diff mbox series

[2/3] kernel-yocto: export CLANG_FLAGS for the kconfiglib config audit

Message ID 20260708022856.2087339-3-mark.yang@lge.com
State Changes Requested
Headers show
Series kernel: make the kernel toolchain switchable to clang | expand

Commit Message

mark.yang July 8, 2026, 2:28 a.m. UTC
From: "mark.yang" <mark.yang@lge.com>

do_kernel_configcheck evaluates Kconfig with kconfiglib instead of
kbuild make, so scripts/Makefile.clang never sets CLANG_FLAGS and the
compiler checks in scripts/Kconfig.include pick it up from the
environment. With TOOLCHAIN = "clang" the audit fails:

  Sorry, this assembler is not supported.

as-version.sh needs -fintegrated-as in the arguments to recognize the
integrated assembler. Export the flags kbuild would use, with gcc this
expands to nothing.

Signed-off-by: mark.yang <mark.yang@lge.com>
---
 meta/classes-recipe/kernel-yocto.bbclass | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index e7fdeb5d4b..46ccc69e75 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -578,6 +578,13 @@  python do_config_analysis() {
                 bb.warn( analysis )
 }
 
+# The kconfiglib audit evaluates Kconfig's compiler checks outside kbuild make,
+# where scripts/Makefile.clang would normally set CLANG_FLAGS, so provide it
+# via the environment.
+CLANG_FLAGS ?= ""
+CLANG_FLAGS:toolchain-clang = "--target=${HOST_SYS} -fintegrated-as"
+export CLANG_FLAGS
+
 python do_kernel_configcheck() {
     import re, string, sys, subprocess