From nobody Thu Dec 18 20:14:23 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 EEE011FFC69; Thu, 13 Feb 2025 14:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739458537; cv=none; b=TlyIdELweyVMiUBGa3bH0dOgFMdL+c1/AFx3x3paoBs1htXELwCs8AVW3digjCB0Mj954IoB4F5gyrOvdyquOzoK+RpzweLLUs/Xx+OE/q/wBff84LPzRVYNiWtwkRKX/IJgSfAEGPmMKgrm9fQErFP2Bi6khxo1H1UMJBYkUWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739458537; c=relaxed/simple; bh=FrlWzJ/Y0927Wnn4CmnicCMg6JslJXYpO2GlTTnKQWk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nrtnOKGVi9TojH8Zt1dintvVkVHbRI9LBsKJa91t2BA5zSOhsa3j0wWdXciMpvOh+DudV7og/eXG2gi8P66Gdqr5fIJsHx7Xxff3LwFcXUQArdjvRTbQDDsDMNbtYaX+WBExjxs7PJzF1IlHe9izD8KZzmHNH+DLAOfnjPdnRhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=O1Ebdatk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gN7K7qt6; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="O1Ebdatk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gN7K7qt6" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1739458533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QxpViyIyD6RBVQ05WeptWSdoHP/MRHDR6Dst2542JiE=; b=O1Ebdatku65ug216me4MAN28DYtauUw0aM3tldxhVdcFIw4/WFf/uW/HHum9TN7KNtGsD9 rjKRzDHi5EiGTfY4T1JN4vQs5QnTlHDphRTbXQi2DpqAJIl7wnUx3PiOGscCyP8p0FAHh+ vOei7o//A3dCB0pJdeXibuA+UQ7e8H5Xic9T2x7n5UQhw5NGbwxOmEVFPe/osB025Q+Fu4 VdQbn0CGCle9LZrQIZupcozmnwDFdIvIaQpnn/eTOcF1ykvuvh86abVA8WRnedtnCtgzMq ZnvsBH+Bx8Ri5usCKecuP+oGlHr73ikbRmB4X56Y3MVRZw7G2d6HvnzIiE0jFQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1739458533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QxpViyIyD6RBVQ05WeptWSdoHP/MRHDR6Dst2542JiE=; b=gN7K7qt6ZfVgMg6MTMU+3eMP5j4jwTaCrOet/znrGheZzwPafa7mzwRpJXiZRVTcHANEY5 I8Dp7G+R41+NkYBg== Date: Thu, 13 Feb 2025 15:55:17 +0100 Subject: [PATCH 1/2] kbuild: userprogs: fix bitsize and target detection on clang Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250213-kbuild-userprog-fixes-v1-1-f255fb477d98@linutronix.de> References: <20250213-kbuild-userprog-fixes-v1-0-f255fb477d98@linutronix.de> In-Reply-To: <20250213-kbuild-userprog-fixes-v1-0-f255fb477d98@linutronix.de> To: Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Sam Ravnborg Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , stable@vger.kernel.org X-Developer-Signature: v=1; a=ed25519-sha256; t=1739458532; l=1335; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=FrlWzJ/Y0927Wnn4CmnicCMg6JslJXYpO2GlTTnKQWk=; b=adzptC/mQxCXrGt1noEivABB6gpXcDp5mhYQmQ3Km5NW0CIrAsc9uSZkmMdT9LWQxLwYYehRB 4MQonHw1uTKDhyt+8jNqUurHFYBpohaLCbLljbiJseYHORuf7Lxb1ft X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= scripts/Makefile.clang was changed in the linked commit to move --target fr= om KBUILD_CFLAGS to KBUILD_CPPFLAGS, as that generally has a broader scope. However that variable is not inspected by the userprogs logic, breaking cross compilation on clang. Use both variables to detect bitsize and target arguments for userprogs. Fixes: feb843a469fb ("kbuild: add $(CLANG_FLAGS) to KBUILD_CPPFLAGS") Cc: stable@vger.kernel.org Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nathan Chancellor --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9e0d63d9d94b90672f91929e5e148e5a0c346cb6..bb5737ce7f9e79f4023c9c1f578= a49a951d1e239 100644 --- a/Makefile +++ b/Makefile @@ -1120,8 +1120,8 @@ LDFLAGS_vmlinux +=3D --orphan-handling=3D$(CONFIG_LD_= ORPHAN_WARN_LEVEL) endif =20 # Align the bit size of userspace programs with the kernel -KBUILD_USERCFLAGS +=3D $(filter -m32 -m64 --target=3D%, $(KBUILD_CFLAGS)) -KBUILD_USERLDFLAGS +=3D $(filter -m32 -m64 --target=3D%, $(KBUILD_CFLAGS)) +KBUILD_USERCFLAGS +=3D $(filter -m32 -m64 --target=3D%, $(KBUILD_CPPFLAGS= ) $(KBUILD_CFLAGS)) +KBUILD_USERLDFLAGS +=3D $(filter -m32 -m64 --target=3D%, $(KBUILD_CPPFLAGS= ) $(KBUILD_CFLAGS)) =20 # make the checker run with the right architecture CHECKFLAGS +=3D --arch=3D$(ARCH) --=20 2.48.1 From nobody Thu Dec 18 20:14:23 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 A9EAB1FFC69; Thu, 13 Feb 2025 14:55:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739458542; cv=none; b=qr4LWZYmHhhGfIJkcBWYWVEJRzZBHCqOdaH+VEiw3pYB2kIu+0W50K9+ju7TaKC2HgT098uA7krvEsqvLKAHANy3JDsagcAto0BzoczhuTTKXRi45FDhiRJlg0nO+oZ9UMVBnhV6kl1kPEnGmT8aVBi+J8BS6hvNaHWTfS4t4v4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739458542; c=relaxed/simple; bh=VsJP2WA7ooxf6Q50q5cBWRfJTkxkoykLDjcBCjCSHrI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EQPKj5ZMD7AviyJS6oOyTOVithpftapfP6LRCACmObFx4Pmkz16aqvp/xhnqNLUGkuaX58CniXu8poURoiQjeDXHTx4dn4X82aT5+mSQkq8mIpyLimWlS7S7or231z2cSzyUlaeyeO8+YrutwY6ZJlU2xxn+dGsmJHXBnILj4aA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=2Y5db328; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=siXfTNw2; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="2Y5db328"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="siXfTNw2" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1739458534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U0Uz4M0nysayxZy8O+uDEBR3eTZPLx7yuVwYwNJRJKg=; b=2Y5db328te54wyfew7h4HOb/N3hvFahLRa/HQxYQcn2qIWZk3Lnq6EZ8/wF9jNz+fCeWuo 0HKZCzi7w8BSY7jRDy5Kqmx6rq/0R4LRN14jTCwismiU/vsAVHzUDCw5a0xIsbacTmA4g8 BmY43HogkQ7hDQEY20pr3fO9VlXPyiAQANb3WIwDzpIh/cDg6rpDzfF9jh7PYpqqmZT0IW sa+tIsilWygLkASpnSfQI+n6LE2WP6m4iXC03lPsqAz2PkZJY5Fvc/hwtWt6f/vOm6faZq HvRd0WX2FGRArDD6TY29E9fkuiSywKsSf9tQUp7m44zhL+VHAjoSpUpfL8jC9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1739458534; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U0Uz4M0nysayxZy8O+uDEBR3eTZPLx7yuVwYwNJRJKg=; b=siXfTNw2xSiOkdln54UCJxk/2Isv3RzFueCNsMvTaaXKOelkE8j18podtAhYikCkPREM6S tS4OoxlyvbrQlzCw== Date: Thu, 13 Feb 2025 15:55:18 +0100 Subject: [PATCH 2/2] kbuild: userprogs: use lld to link through clang Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250213-kbuild-userprog-fixes-v1-2-f255fb477d98@linutronix.de> References: <20250213-kbuild-userprog-fixes-v1-0-f255fb477d98@linutronix.de> In-Reply-To: <20250213-kbuild-userprog-fixes-v1-0-f255fb477d98@linutronix.de> To: Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Sam Ravnborg Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , stable@vger.kernel.org X-Developer-Signature: v=1; a=ed25519-sha256; t=1739458532; l=1464; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=VsJP2WA7ooxf6Q50q5cBWRfJTkxkoykLDjcBCjCSHrI=; b=8OMIVLKzPjKBGa+nsuyZo48SgY/H7ox75L6z9V8p2CPGZuYfEbGXiibYamh8B6s+e9cikZVwq UOOjyGCL6v+DwjajMJZig3VnB/KagLzox2tccsCQfBkVnRBxL8VhKQQ X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= 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 wo= uld be used for linking if LLVM=3D1 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 alwa= ys executed directly, without the compiler being involved. Fix this by passing -fuse-lld and let clang find its matching lld. Fixes: 7f3a59db274c ("kbuild: add infrastructure to build userspace program= s") Cc: stable@vger.kernel.org Signed-off-by: Thomas Wei=C3=9Fschuh --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index bb5737ce7f9e79f4023c9c1f578a49a951d1e239..b4c208ae4041c1f4e32c2a15832= 2422ce7353d06 100644 --- a/Makefile +++ b/Makefile @@ -510,6 +510,7 @@ OBJCOPY =3D $(LLVM_PREFIX)llvm-objcopy$(LLVM_SUFFIX) OBJDUMP =3D $(LLVM_PREFIX)llvm-objdump$(LLVM_SUFFIX) READELF =3D $(LLVM_PREFIX)llvm-readelf$(LLVM_SUFFIX) STRIP =3D $(LLVM_PREFIX)llvm-strip$(LLVM_SUFFIX) +KBUILD_USERLDFLAGS +=3D -fuse-ld=3Dlld else CC =3D $(CROSS_COMPILE)gcc LD =3D $(CROSS_COMPILE)ld --=20 2.48.1