]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
kbuild: userprogs: use correct linker when mixing clang and GNU ld
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Thu, 21 Aug 2025 18:31:06 +0000 (11:31 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:22:52 +0000 (16:22 +0200)
commit244ddfdaabd58b13a8697c51a361cc366d488d1c
tree6c7dc914dc1d18ca4e82418570a11e861e5daa3c
parentcf3ad6aa10f8918834ef5eb0e95fe8bb233d09d4
kbuild: userprogs: use correct linker when mixing clang and GNU ld

commit 936599ca514973d44a766b7376c6bbdc96b6a8cc upstream.

The userprogs infrastructure does not expect clang being used with GNU ld
and in that case uses /usr/bin/ld for linking, not the configured $(LD).
This fallback is problematic as it will break when cross-compiling.
Mixing clang and GNU ld is used for example when building for SPARC64,
as ld.lld is not sufficient; see Documentation/kbuild/llvm.rst.

Relax the check around --ld-path so it gets used for all linkers.

Fixes: dfc1b168a8c4 ("kbuild: userprogs: use correct lld when linking through clang")
Cc: stable@vger.kernel.org
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: Work around wrapping '--ld-path' in cc-option in older stable
         branches due to older minimum LLVM version]
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Makefile