[PATCH] microblaze: Build userprogs for the correct endianness

From: Thomas Weißschuh

Date: Sat Sep 19 2026 - 14:44:06 EST


Currently microblaze userprogs are built for whichever endianness is the
default for the use toolchain. They may not be the correct one for the
actually built kernel.

Implement the correct hooks to build userprogs so they can run on the
built kernel. Also test the endianness in CC_CAN_LINK.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
arch/microblaze/Kconfig | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 0ca8999dd770..9063a91cfb41 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -3,6 +3,7 @@ config MICROBLAZE
def_bool y
select ARCH_32BIT_OFF_T
select ARCH_NO_SWAP
+ select ARCH_HAS_CC_CAN_LINK
select ARCH_HAS_DMA_PREP_COHERENT
select ARCH_HAS_GCOV_PROFILE_ALL
select ARCH_HAS_SYNC_DMA_FOR_CPU
@@ -225,3 +226,13 @@ config MB_POWER_OFF_THROUGH_UNALIGNED_PC
petalogix-s3adsp1800 QEMU machine.

Say N here unless you know what you are doing.
+
+config ARCH_CC_CAN_LINK
+ bool
+ default $(cc_can_link_user,-mlittle-endian) if CPU_LITTLE_ENDIAN
+ default $(cc_can_link_user,-mbig-endian) if CPU_BIG_ENDIAN
+
+config ARCH_USERFLAGS
+ string
+ default "-mlittle-endian" if CPU_LITTLE_ENDIAN
+ default "-mbig-endian" if CPU_BIG_ENDIAN

---
base-commit: 7396bcfc05046e779d255c6af57cd7838f30d41c
change-id: 20260919-microblaze-cc-can-link-4b2c69373700

Best regards,
--
Thomas Weißschuh <linux@xxxxxxxxxxxxxx>