From nobody Sat Oct 4 20:54:34 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 1A8788462; Wed, 13 Aug 2025 05:43:46 +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=1755063828; cv=none; b=T3EWPEKJ4xo7SAkHAgoWSWderr9iuZgULiNxHc+lWFu9JJwVIyaGF3V8WPRQxBUxvChn1cZU0AqLEYK3DXZoZbCfafaK6bFmnMO2inh4r1hDXpD4Uqj+g3+OxtKl/U7rQfBayGUl5Lvd7YgV+JebQX/sTGRCgeG19rmYt3uk5jQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755063828; c=relaxed/simple; bh=vP+mEMF62ZxB+CQTd3DW4S+/ofi1vI/hpcMlDiLTr6M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UyfLoGG832w+ZdVhstYeweuzkpf4HIbOJsg5SUNRlZFg/8SvZiSG8lgaJk36POuXGRi2d6nxIYzvBGp1QET9PBBa6VB807gEuNYA249bMxaE9QG0tbrmD2EwUDQx08vbHK+2M5fiQMlGfYAZ5Vu5tbU6VwNSmE27P8HyezhOruc= 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=G43M3/Eu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fZC2Lul5; 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="G43M3/Eu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fZC2Lul5" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1755063825; 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=lda1+k9NvAni072lcSmj/XvjHbnivRVjlPOdUFZuhk0=; b=G43M3/Euc4h+od5NZgN6q6JrNOCthzCh/G8bdMLklkVKKI+E1m6veDY2/foLihis0JBw3n TT2Qbb6OhjUFc+RLxh8WDIF1ByLDyuFNB8vnlE2ptt8AP5AQ2w60tUv2u7apbmy4kQDka/ M9YjVo4TuCGArAg7+4CPS5H6Fg+hBQeST05ncnCpF3gvvTXIJoB+AhMZiymimzUsfz7XQl m8EyY37WskEdX7lmZVp3qalj4IXqRjP6qdMsOTTZKZwoo5sztn9SabyrN6rgepiXgns9yW Bw0CW5ZkXI+pz2Ron/Shtzm9ae9BUuEl2/rJvIgstwIDt16MjCPyNv93W8B2cA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1755063825; 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=lda1+k9NvAni072lcSmj/XvjHbnivRVjlPOdUFZuhk0=; b=fZC2Lul5TrKY+M0zMieULtXYpvwNSc5nECRdGlD8UO8fSu2q7iJgNIUbs4SYxGslZNlI8N KBGnSP4mCe4YZdDg== Date: Wed, 13 Aug 2025 07:43:40 +0200 Subject: [PATCH 1/2] kbuild: userprogs: avoid duplication of flags inherited from kernel 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: <20250813-kbuild-userprogs-bits-v1-1-2d9f7f411083@linutronix.de> References: <20250813-kbuild-userprogs-bits-v1-0-2d9f7f411083@linutronix.de> In-Reply-To: <20250813-kbuild-userprogs-bits-v1-0-2d9f7f411083@linutronix.de> To: Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Nicolas Schier X-Developer-Signature: v=1; a=ed25519-sha256; t=1755063823; l=1255; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=vP+mEMF62ZxB+CQTd3DW4S+/ofi1vI/hpcMlDiLTr6M=; b=rQMgzncsTYfaPjfHhfNgQ+ukSBY44NlFn9xqwCvAuJ2OT1XLw+adRLqXpjbroZw9pk0gIVL2j Q9LDpoHmfHBAWdKAiHbDNFDtRbsIdqpTXM2BqTU8kjbZbIG4XPWYOyh X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The duplication makes maintenance harder. Changes need to be done in two places and the lines will grow overly long. Use an intermediary variable instead. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nicolas Schier Acked-by: Masahiro Yamada --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6bfe776bf3c5ff0cf187dc6719dd5817cd4af2ca..d0f5262a9c0f3b4aa79a91c20cc= 149d034ffa0b7 100644 --- a/Makefile +++ b/Makefile @@ -1138,8 +1138,9 @@ LDFLAGS_vmlinux +=3D --emit-relocs --discard-none endif =20 # Align the bit size of userspace programs with the kernel -KBUILD_USERCFLAGS +=3D $(filter -m32 -m64 --target=3D%, $(KBUILD_CPPFLAGS= ) $(KBUILD_CFLAGS)) -KBUILD_USERLDFLAGS +=3D $(filter -m32 -m64 --target=3D%, $(KBUILD_CPPFLAGS= ) $(KBUILD_CFLAGS)) +USERFLAGS_FROM_KERNEL :=3D -m32 -m64 --target=3D% +KBUILD_USERCFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) +KBUILD_USERLDFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) =20 # userspace programs are linked via the compiler, use the correct linker ifdef CONFIG_CC_IS_CLANG --=20 2.50.1 From nobody Sat Oct 4 20:54:34 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 45AC92BEC45; Wed, 13 Aug 2025 05:43:46 +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=1755063829; cv=none; b=UVp3LjqalGO2YljbiJDjgc2fAkH11GXF7HrJMsYEMYJFOLFl4AtL2edhMsxkjI47YYdIs2Q+LN7Kc6lcGYj7JRAjhwvBKJLDNv0ocqXsB0mN4JB9AnjmZMzaTC8eKPFBkiZukQMRFV4zvDSTMyNJJ2/mdWOTJlpv/ZXsbb3Ekeg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755063829; c=relaxed/simple; bh=WR4nebXv6cq3ocU+EuA9grEkBv0PYXkTdupjBs02LlI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZQlQ2SRwBubi5Ig31v4FypXnvA11y2teL1V6rmcmEso6uP6zWlhxzmuD/OQmbSxNLal5qZwr97vTx2II5JeJC7l94m6qenrhe3i8u54zEZPzfIwTeCtUsQy/wI8J8TtKjyt2rAAh0Hy5AQi07E8k1Y4wr2h9xZvGCig43VEmKVQ= 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=lBGnGSy2; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=gjTREMR1; 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="lBGnGSy2"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="gjTREMR1" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1755063825; 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=TC4Oy3+8Vj3UOd09UD4NHTiWUTfFsnY6dc7LNc275Jg=; b=lBGnGSy28P1ZdeaXXFxA8xg9buVI4cBlTI0xeKaIBfBFzskm9E85XDFOoIphEIbGJAHydL 7XzgglSqwEUoq/uwVFubP0EPwsJ3ScSa0OnVYyasEUrC8uRJE1P1gj/3MCKJCrodDpIDxx 9B1EzeaoFm95EUguSa/kYuPy8VeCQXYTpdDIinqNrMY7tYGcqWm5wJCyCkTRT5sc4Wa+FC +Ipn87ZH14WlHkigpJU+dIoY7E3mPtFZyfyRA8urChptNArAuwV1JJ+18Q/kJsrmd90o01 FhGZvHt4m6Mv3zPlGDX3OH4P3TkJxqDB/w/tKs00TImC2cpRTxuwwTWyVjaOmg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1755063825; 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=TC4Oy3+8Vj3UOd09UD4NHTiWUTfFsnY6dc7LNc275Jg=; b=gjTREMR1jNcfJo/oW+tErZnE+Jza12tSDHFjb8E9ZA+u+Y1DXEenldfGUhdmU+cGvnOwA5 8xPAp908F5SUdfCw== Date: Wed, 13 Aug 2025 07:43:41 +0200 Subject: [PATCH 2/2] kbuild: userprogs: also inherit byte order and ABI from kernel 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: <20250813-kbuild-userprogs-bits-v1-2-2d9f7f411083@linutronix.de> References: <20250813-kbuild-userprogs-bits-v1-0-2d9f7f411083@linutronix.de> In-Reply-To: <20250813-kbuild-userprogs-bits-v1-0-2d9f7f411083@linutronix.de> To: Nathan Chancellor , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Masahiro Yamada , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= , Nicolas Schier X-Developer-Signature: v=1; a=ed25519-sha256; t=1755063823; l=1353; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=WR4nebXv6cq3ocU+EuA9grEkBv0PYXkTdupjBs02LlI=; b=M0fP1hKhNJ4QE+hfgk9YoyPLzju+wy9ByxE9ZDs+uqBWz3MfKczC/npr8PqVA6BuXcLRIhUgO e9xFb7OASSHAZ7/4M5ri2E1YKLFyM+wDkTmOcapcGnqXXHGFkmtc1Ui X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Make sure the byte order and ABI of the userprogs matches the one of the kernel, similar to how the bit size is handled. Otherwise the userprogs may not be executable. This happens for example on powerpc little endian, or riscv32. Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: Nicolas Schier Acked-by: Masahiro Yamada --- Difference to original series: * Also handle -EL/-EB for MIPS --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d0f5262a9c0f3b4aa79a91c20cc149d034ffa0b7..7d40f84d5efde18ed3a2f4d8cf7= a9b1ec3610ed4 100644 --- a/Makefile +++ b/Makefile @@ -1137,8 +1137,8 @@ ifneq ($(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS),) LDFLAGS_vmlinux +=3D --emit-relocs --discard-none endif =20 -# Align the bit size of userspace programs with the kernel -USERFLAGS_FROM_KERNEL :=3D -m32 -m64 --target=3D% +# Align the bit size, byte order and architecture of userspace programs wi= th the kernel +USERFLAGS_FROM_KERNEL :=3D -m32 -m64 -mlittle-endian -mbig-endian -EL -EB = --target=3D% -march=3D% -mabi=3D% KBUILD_USERCFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) KBUILD_USERLDFLAGS +=3D $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLA= GS) $(KBUILD_CFLAGS)) =20 --=20 2.50.1