[PATCH v3 01/16] kbuild: userprogs: avoid duplicating of flags inherited from kernel

0 views
Skip to first unread message

Thomas Weißschuh

unread,
Jun 11, 2025, 3:38:34 AMJun 11
to Masahiro Yamada, Nathan Chancellor, Andrew Morton, Willy Tarreau, Thomas Weißschuh, Brendan Higgins, David Gow, Rae Moar, Shuah Khan, Jonathan Corbet, Nicolas Schier, Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Christophe Leroy, linux-...@vger.kernel.org, linux-...@vger.kernel.org, linux-k...@vger.kernel.org, kuni...@googlegroups.com, linu...@vger.kernel.org, linux...@lists.infradead.org, work...@vger.kernel.org, Thomas Weißschuh
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.w...@linutronix.de>
---
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 35e6e5240c61a8a329011929fcd0352b881dccdc..c4293cf91e968ca8ee64452841fb266e24df63f6 100644
--- a/Makefile
+++ b/Makefile
@@ -1130,8 +1130,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
ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_LD_IS_LLD),yy)

--
2.49.0

Nicolas Schier

unread,
Jun 11, 2025, 9:53:15 AMJun 11
to Thomas Weißschuh, Masahiro Yamada, Nathan Chancellor, Andrew Morton, Willy Tarreau, Thomas Weißschuh, Brendan Higgins, David Gow, Rae Moar, Shuah Khan, Jonathan Corbet, Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Christophe Leroy, linux-...@vger.kernel.org, linux-...@vger.kernel.org, linux-k...@vger.kernel.org, kuni...@googlegroups.com, linu...@vger.kernel.org, linux...@lists.infradead.org, work...@vger.kernel.org
On Wed, Jun 11, 2025 at 09:38:07AM +0200, Thomas Weißschuh wrote:
> 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.w...@linutronix.de>
> ---
> Makefile | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>

Reviewed-by: Nicolas Schier <n.sc...@avm.de>
Reply all
Reply to author
Forward
0 new messages