kbuild: userprogs: avoid duplication of flags inherited from kernel

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ßschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Nicolas Schier <n.schier@avm.de>
Acked-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20250813-kbuild-userprogs-bits-v1-1-2d9f7f411083@linutronix.de
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
pull/1354/merge
Thomas Weißschuh 2025-08-13 07:43:40 +02:00 committed by Nathan Chancellor
parent 27758d8c25
commit 2d0ec4a931
No known key found for this signature in database
GPG Key ID: 1D6B269171C01A96
1 changed files with 3 additions and 2 deletions

View File

@ -1135,8 +1135,9 @@ LDFLAGS_vmlinux += --emit-relocs --discard-none
endif
# Align the bit size of userspace programs with the kernel
KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
USERFLAGS_FROM_KERNEL := -m32 -m64 --target=%
KBUILD_USERCFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
KBUILD_USERLDFLAGS += $(filter $(USERFLAGS_FROM_KERNEL), $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
# userspace programs are linked via the compiler, use the correct linker
ifdef CONFIG_CC_IS_CLANG