[PATCH OLK-6.6] kbuild: userprogs: use correct linker when mixing clang and GNU ld

From: Thomas Weißschuh <thomas.weissschuh@linutronix.de> mainline inclusion from mainline-v6.17 commit 936599ca514973d44a766b7376c6bbdc96b6a8cc category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICRNOY Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... -------------------------------- 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> Conflicts: Makefile [Context conflicts] Signed-off-by: Tengda Wu <wutengda2@huawei.com> --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4cbc72182f6b..2a6541892eea 100644 --- a/Makefile +++ b/Makefile @@ -1060,7 +1060,7 @@ KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD 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) +ifdef CONFIG_CC_IS_CLANG KBUILD_USERLDFLAGS += $(call cc-option, --ld-path=$(LD)) endif -- 2.34.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/17465 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UTU... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/17465 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UTU...
participants (2)
-
patchwork bot
-
Tengda Wu