Kbuild fixes for v6.14 (3rd)

- Use the specified $(LD) when building userprogs with Clang
 
  - Pass the correct target triple when compile-testing UAPI headers
    with Clang
 
  - Fix pacman-pkg build error with KBUILD_OUTPUT
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmfN23gVHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGui0P/0SOGcw7fprs7nKLbGKxwj6zVz+Y
 0kf/lVDrabyPc7AznsBVaoRNTJK7XkkpWsOyMLIRbrFRl9rFDZwvJXP9AKP4lSwM
 km7D6r27WBi06GlOyRHDt3bFUxYscS8NbDJ9g4gYqTJ0Rm0G+GwxHKsfSwEjDdg4
 jGaq3+lVqcHSywxmEApDOLyI1rZhcF0qSIqUW4EXY+m/Z5Z+Um0CjAMibN8ljphQ
 nk4I8HmFQgGoE5nVT8/KrrJdZlgEZp1QRU4LD5ToFfg+4ehukqkVg11c5lMsdUke
 P8Blok65r+cNFCLzfBrALHx+PnAefV3c5KdrGLZArNbyjLaPDmMcY02+CbPwzEvY
 UEpC69h9ygOHMUcdyGRxvB4DNS92yiO0GNBnG8giMUjpnrTiThPZ1eIhoUR9T87J
 QYk2RLJ1APwOtvQ87WKA5LnTTSJlxizWhaD/8n5Z2vmleYUdnl9r3JG1OV8Gre4p
 S7izDsckYm13g32R/kAaVDnLWUjVHZMOF6SCq4wpej8uG8LPAPy8Ji7xMLJ7B6Vr
 hlpJM2mkM+NnIAYVLmbXGXWSLu6Xw80PPWJm8dqcKDqdof64DM8/xXNCgTIuQwgl
 ravUau+KLx70R9vG+wPZLgpDTxT4WkUP9rtpxBrdmMyQzB2CrPPF3pteOehfX2BP
 7GJVR2lw0XkCx0rg
 =V4ee
 -----END PGP SIGNATURE-----

Merge tag 'kbuild-fixes-v6.14-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Use the specified $(LD) when building userprogs with Clang

 - Pass the correct target triple when compile-testing UAPI headers
   with Clang

 - Fix pacman-pkg build error with KBUILD_OUTPUT

* tag 'kbuild-fixes-v6.14-3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  kbuild: install-extmod-build: Fix build when specifying KBUILD_OUTPUT
  docs: Kconfig: fix defconfig description
  kbuild: hdrcheck: fix cross build with clang
  kbuild: userprogs: use correct lld when linking through clang
This commit is contained in:
Linus Torvalds 2025-03-09 09:23:14 -10:00
commit 9712d38c87
4 changed files with 8 additions and 3 deletions

View file

@ -176,7 +176,7 @@ Configuring the kernel
values without prompting. values without prompting.
"make defconfig" Create a ./.config file by using the default "make defconfig" Create a ./.config file by using the default
symbol values from either arch/$ARCH/defconfig symbol values from either arch/$ARCH/configs/defconfig
or arch/$ARCH/configs/${PLATFORM}_defconfig, or arch/$ARCH/configs/${PLATFORM}_defconfig,
depending on the architecture. depending on the architecture.

View file

@ -1123,6 +1123,11 @@ endif
KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS)) KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
# userspace programs are linked via the compiler, use the correct linker
ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy)
KBUILD_USERLDFLAGS += --ld-path=$(LD)
endif
# make the checker run with the right architecture # make the checker run with the right architecture
CHECKFLAGS += --arch=$(ARCH) CHECKFLAGS += --arch=$(ARCH)

View file

@ -63,7 +63,7 @@ if [ "${CC}" != "${HOSTCC}" ]; then
# Clear VPATH and srcroot because the source files reside in the output # Clear VPATH and srcroot because the source files reside in the output
# directory. # directory.
# shellcheck disable=SC2016 # $(MAKE) and $(build) will be expanded by Make # shellcheck disable=SC2016 # $(MAKE) and $(build) will be expanded by Make
"${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC='"${CC}"' VPATH= srcroot=. $(build)='"${destdir}"/scripts "${MAKE}" run-command KBUILD_RUN_COMMAND='+$(MAKE) HOSTCC='"${CC}"' VPATH= srcroot=. $(build)='"$(realpath --relative-base=. "${destdir}")"/scripts
rm -f "${destdir}/scripts/Kbuild" rm -f "${destdir}/scripts/Kbuild"
fi fi

View file

@ -10,7 +10,7 @@ UAPI_CFLAGS := -std=c90 -Wall -Werror=implicit-function-declaration
# In theory, we do not care -m32 or -m64 for header compile tests. # In theory, we do not care -m32 or -m64 for header compile tests.
# It is here just because CONFIG_CC_CAN_LINK is tested with -m32 or -m64. # It is here just because CONFIG_CC_CAN_LINK is tested with -m32 or -m64.
UAPI_CFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) UAPI_CFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
# USERCFLAGS might contain sysroot location for CC. # USERCFLAGS might contain sysroot location for CC.
UAPI_CFLAGS += $(USERCFLAGS) UAPI_CFLAGS += $(USERCFLAGS)