Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: clang: Support building UM with SUBARCH=i386

The UM builds distinguish i386 from x86_64 via SUBARCH, but we don't
support building i386 directly with Clang. To make SUBARCH work for
i386 UM, we need to explicitly test for it.

This lets me run i386 KUnit tests with Clang:

$ ./tools/testing/kunit/kunit.py run \
--make_options LLVM=1 \
--make_options SUBARCH=i386
...

Fixes: c7500c1b53bf ("um: Allow builds with Clang")
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250304162124.it.785-kees@kernel.org
Tested-by: David Gow <davidgow@google.com>
Signed-off-by: Kees Cook <kees@kernel.org>

+2
+2
scripts/Makefile.clang
··· 12 12 CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu 13 13 CLANG_TARGET_FLAGS_sparc := sparc64-linux-gnu 14 14 CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu 15 + # This is only for i386 UM builds, which need the 32-bit target not -m32 16 + CLANG_TARGET_FLAGS_i386 := i386-linux-gnu 15 17 CLANG_TARGET_FLAGS_um := $(CLANG_TARGET_FLAGS_$(SUBARCH)) 16 18 CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(SRCARCH)) 17 19