From 1f2239c47e4a8ffb4c34b5120d71cbca6f0b4825 Mon Sep 17 00:00:00 2001 From: Jose Quaresma Date: Tue, 9 May 2023 10:07:43 +0000 Subject: [PATCH] fixup! base: linux-lmp: build with clang --- .../recipes-kernel/linux/linux-lmp-clang.inc | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/meta-lmp-base/recipes-kernel/linux/linux-lmp-clang.inc b/meta-lmp-base/recipes-kernel/linux/linux-lmp-clang.inc index 03064924f4..930cb26d40 100644 --- a/meta-lmp-base/recipes-kernel/linux/linux-lmp-clang.inc +++ b/meta-lmp-base/recipes-kernel/linux/linux-lmp-clang.inc @@ -3,10 +3,28 @@ TOOLCHAIN:forcevariable = "clang" DEPENDS:append:toolchain-clang = " clang-cross-${TARGET_ARCH}" -KERNEL_CC:toolchain-clang = "${CCACHE}clang ${HOST_CC_KERNEL_ARCH} ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH}" +KERNEL_CC:toolchain-clang = "${CCACHE}clang ${HOST_CC_KERNEL_ARCH} -fuse-ld=lld ${DEBUG_PREFIX_MAP} -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH}" KERNEL_LD:toolchain-clang = "${CCACHE}ld.lld" KERNEL_AR:toolchain-clang = "${CCACHE}llvm-ar" +# explicitly enable LLVM +# https://docs.kernel.org/kbuild/llvm.html +KERNEL_EXTRA_ARGS += "LLVM=1" + +# verbose build +KERNEL_EXTRA_ARGS += "V=1" + # FIXME: hacks do_kernel_configcheck[noexec] = "1" -CFLAGS:append:toolchain-clang = " -Wno-error=address-of-packed-member" + +# error: taking address of packed member 'xxx' of class or structure 'yyy' may result in an unaligned pointer value [-Werror,-Waddress-of-packed-member] +# kernel build use BUILD_CFLAGS instaed of CFLAGS +#CFLAGS:append:toolchain-clang = " -Wno-address-of-packed-member" +#BUILD_CFLAGS:append:toolchain-clang = " -Wno-address-of-packed-member" +#BUILD_CXXFLAGS:append:toolchain-clang = " -Wno-address-of-packed-member" +# none of the above works! +# because kernel don't use CFLAGS we need to pass it over EXTRA_OEMAKE +EXTRA_OEMAKE += 'CFLAGS="-Wno-address-of-packed-member"' + +# needed on kirkstone: don't fix the fail +#EXTRA_OEMAKE += 'AR="${KERNEL_AR}"'