Skip to content

Commit 7f58b48

Browse files
committed
kbuild: make Clang build userprogs for target architecture
Programs added 'userprogs' should be compiled for the target architecture i.e. the same architecture as the kernel. GCC does this correctly since the target architecture is implied by the toolchain prefix. Clang builds userspace programs always for the host architecture because the target triple is currently missing. Fix this. Fixes: 7f3a59d ("kbuild: add infrastructure to build userspace programs") Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]>
1 parent b816b3d commit 7f58b48

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@ LDFLAGS_vmlinux += --pack-dyn-relocs=relr
970970
endif
971971

972972
# Align the bit size of userspace programs with the kernel
973-
KBUILD_USERCFLAGS += $(filter -m32 -m64, $(KBUILD_CFLAGS))
974-
KBUILD_USERLDFLAGS += $(filter -m32 -m64, $(KBUILD_CFLAGS))
973+
KBUILD_USERCFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
974+
KBUILD_USERLDFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS))
975975

976976
# make the checker run with the right architecture
977977
CHECKFLAGS += --arch=$(ARCH)

0 commit comments

Comments
 (0)