From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nicolas.schier@linux.dev>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
"Masahiro Yamada" <masahiroy@kernel.org>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Nicolas Schier" <nicolas.schier@linux.dev>
Subject: [PATCH 2/2] kbuild: userprogs: also inherit byte order and ABI from kernel
Date: Wed, 13 Aug 2025 07:43:41 +0200 [thread overview]
Message-ID: <20250813-kbuild-userprogs-bits-v1-2-2d9f7f411083@linutronix.de> (raw)
In-Reply-To: <20250813-kbuild-userprogs-bits-v1-0-2d9f7f411083@linutronix.de>
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ßschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Acked-by: Masahiro Yamada <masahiroy@kernel.org>
---
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..7d40f84d5efde18ed3a2f4d8cf7a9b1ec3610ed4 100644
--- a/Makefile
+++ b/Makefile
@@ -1137,8 +1137,8 @@ ifneq ($(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS),)
LDFLAGS_vmlinux += --emit-relocs --discard-none
endif
-# Align the bit size of userspace programs with the kernel
-USERFLAGS_FROM_KERNEL := -m32 -m64 --target=%
+# Align the bit size, byte order and architecture of userspace programs with the kernel
+USERFLAGS_FROM_KERNEL := -m32 -m64 -mlittle-endian -mbig-endian -EL -EB --target=% -march=% -mabi=%
KBUILD_USERCFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
KBUILD_USERLDFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
--
2.50.1
next prev parent reply other threads:[~2025-08-13 5:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 5:43 [PATCH 0/2] kbuild: userprogs: also inherit byte order and ABI from kernel Thomas Weißschuh
2025-08-13 5:43 ` [PATCH 1/2] kbuild: userprogs: avoid duplication of flags inherited " Thomas Weißschuh
2025-08-13 5:43 ` Thomas Weißschuh [this message]
2025-08-27 6:31 ` [PATCH 2/2] kbuild: userprogs: also inherit byte order and ABI " Thomas Weißschuh
2025-08-27 22:49 ` Nathan Chancellor
2025-09-01 9:51 ` Thomas Weißschuh
2025-09-03 22:31 ` Nathan Chancellor
2025-08-14 18:46 ` [PATCH 0/2] " Nathan Chancellor
2025-08-15 5:57 ` Thomas Weißschuh
2025-08-15 21:16 ` Nathan Chancellor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250813-kbuild-userprogs-bits-v1-2-2d9f7f411083@linutronix.de \
--to=thomas.weissschuh@linutronix.de \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas.schier@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).