Re: Patch "kbuild: userprogs: use correct lld when linking through clang" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 09, 2025 at 09:31:48PM +0100, gregkh@xxxxxxxxxxxxxxxxxxx wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     kbuild: userprogs: use correct lld when linking through clang
> 
> to the 6.6-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch
> and it can be found in the queue-6.6 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@xxxxxxxxxxxxxxx> know about it.
> 
> 
> From dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <thomas.weissschuh@xxxxxxxxxxxxx>
> Date: Mon, 17 Feb 2025 08:27:54 +0100
> Subject: kbuild: userprogs: use correct lld when linking through clang
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> From: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> 
> commit dfc1b168a8c4b376fa222b27b97c2c4ad4b786e1 upstream.
> 
> The userprog infrastructure links objects files through $(CC).
> Either explicitly by manually calling $(CC) on multiple object files or
> implicitly by directly compiling a source file to an executable.
> The documentation at Documentation/kbuild/llvm.rst indicates that ld.lld
> would be used for linking if LLVM=1 is specified.
> However clang instead will use either a globally installed cross linker
> from $PATH called ${target}-ld or fall back to the system linker, which
> probably does not support crosslinking.
> For the normal kernel build this is not an issue because the linker is
> always executed directly, without the compiler being involved.
> 
> Explicitly pass --ld-path to clang so $(LD) is respected.
> As clang 13.0.1 is required to build the kernel, this option is available.
> 
> Fixes: 7f3a59db274c ("kbuild: add infrastructure to build userspace programs")
> Cc: stable@xxxxxxxxxxxxxxx # needs wrapping in $(cc-option) for < 6.9
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
>  Makefile |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> --- a/Makefile
> +++ b/Makefile
> @@ -1057,6 +1057,11 @@ endif
>  KBUILD_USERCFLAGS  += $(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)

No objections obviously but as the note next to the stable cc mentions
above, can you make this

  $(call cc-option, --ld-path=$(LD))

for 6.6 and older? It is only for two clang versions but still :)

> +endif
> +
>  # make the checker run with the right architecture
>  CHECKFLAGS += --arch=$(ARCH)
>  
> 
> 
> Patches currently in stable-queue which might be from thomas.weissschuh@xxxxxxxxxxxxx are
> 
> queue-6.6/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux