Skip to content

Commit

Permalink
fixup! base: linux-lmp: build with clang
Browse files Browse the repository at this point in the history
  • Loading branch information
quaresmajose committed May 9, 2023
1 parent bcc457f commit 1f2239c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions meta-lmp-base/recipes-kernel/linux/linux-lmp-clang.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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}"'

0 comments on commit 1f2239c

Please sign in to comment.