]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Mar 2025 16:42:45 +0000 (17:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Mar 2025 16:42:45 +0000 (17:42 +0100)
added patches:
kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch

queue-6.6/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch b/queue-6.6/kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch
new file mode 100644 (file)
index 0000000..9b00ee1
--- /dev/null
@@ -0,0 +1,50 @@
+From 89dc7c7a9f6f609fb5c9c6ed819bf99cf2e373a2 Mon Sep 17 00:00:00 2001
+From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
+Date: Mon, 17 Feb 2025 08:27:54 +0100
+Subject: kbuild: userprogs: use correct lld when linking through clang
+
+From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
+
+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@vger.kernel.org # needs wrapping in $(cc-option) for < 6.9
+Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
+Reviewed-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+[nathan: use cc-option for 6.6 and older, as those trees support back to
+         clang-11]
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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 += $(call cc-option, --ld-path=$(LD))
++endif
++
+ # make the checker run with the right architecture
+ CHECKFLAGS += --arch=$(ARCH)
index bd51bd839cfa694029fce282155e3219affe030e..329736ba12dd7b094de1d208007bdbac655b3210 100644 (file)
@@ -142,3 +142,4 @@ x86-boot-rename-conflicting-boot_params-pointer-to-boot_params_ptr.patch
 x86-boot-sanitize-boot-params-before-parsing-command-line.patch
 spi-mxs-fix-chipselect-glitch.patch
 pfifo_tail_enqueue-drop-new-packet-when-sch-limit-0.patch
+kbuild-userprogs-use-correct-lld-when-linking-through-clang.patch