From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C63B2FFDF2; Tue, 26 Aug 2025 13:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756215186; cv=none; b=GIPGn4VGmtUqF7WyfWqGwdvlHMD2m7cgS+SrQ4BgUKB1LQInCc+vV0c4aKMZGPHA4ilgQb6tPzSmQqk7vu8+8bGweBbShpwUfRMdi6mc7UV5+NAMr9NQvOaslPK6hRJ3vbbcfrV4Yqd3S9r7UZcfDwQEcHHVWIDncRdkddeUL6o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756215186; c=relaxed/simple; bh=sxVPEBfzxk1wyowvRMvQnTV+rxuIFQSKRQOoEo04vuY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UjvfB3Rb4YlT6eiENa0+9abIIyNFeWN/S2NH0R1OMSs4inwvkYEc6Dbzy3SkauhbudAGP5Bkn4K4X2vNOHkEKS9QRKVF3TAGs3xv1TeGIk5gH1nubZiK/ZwBIOmazJiz2g/pwxFH0917I7DG1IP9PwWG4bQYlEpO0PufeUL3+ow= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=iVhwphxo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="iVhwphxo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9173CC113D0; Tue, 26 Aug 2025 13:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1756215185; bh=sxVPEBfzxk1wyowvRMvQnTV+rxuIFQSKRQOoEo04vuY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iVhwphxojLsPMU4Xv5Bh+qDxVsXifVbXLGtrfQIF7uDglBSWratp6x+ZO4Jm9V4/J Aa3rL0hxfuUTZwOaqBtzD6uwqKgJXr9YOux0Lp5VJm0s/2ZnP7waVAsD7gp9z6cGGn S71n9mxYJFnxiGsR66ehTAqEqxFiLrIVshk19pW4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Nathan Chancellor , Masahiro Yamada Subject: [PATCH 6.1 389/482] kbuild: userprogs: use correct linker when mixing clang and GNU ld Date: Tue, 26 Aug 2025 13:10:42 +0200 Message-ID: <20250826110940.438746717@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250826110930.769259449@linuxfoundation.org> References: <20250826110930.769259449@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Weißschuh 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 Reviewed-by: Nathan Chancellor Signed-off-by: Masahiro Yamada [nathan: Work around wrapping '--ld-path' in cc-option in older stable branches due to older minimum LLVM version] Signed-off-by: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Makefile +++ b/Makefile @@ -1143,7 +1143,7 @@ KBUILD_USERCFLAGS += $(filter -m32 -m64 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