]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
LoongArch: Specify -m32/-m64 explicitly for 32BIT/64BIT
authorHuacai Chen <chenhuacai@loongson.cn>
Mon, 4 May 2026 01:00:01 +0000 (09:00 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Mon, 4 May 2026 01:00:01 +0000 (09:00 +0800)
Clang/LLVM build needs -m32/-m64 to switch triple variants (i.e. the
--target=xxx parameter). Otherwise we get build errors for CONFIG_32BIT.

GCC doesn't support -m32/-m64 now, but maybe support in future, so use
cc-option to specify them.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202604232041.ESJDwVG4-lkp@intel.com/
Suggested-by: Nathan Chancellor <nathan@kernel.org
Tested-by: WANG Rui <wangrui@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/Makefile
arch/loongarch/vdso/Makefile

index 47516aeea9d29f51f63eac2b1c2dde00245ed377..54fcfa1eac1f89cc6f2ce9c161651b2d66958059 100644 (file)
@@ -55,9 +55,11 @@ endif
 ifdef CONFIG_32BIT
 tool-archpref          = $(32bit-tool-archpref)
 UTS_MACHINE            := loongarch32
+cflags-y               += $(call cc-option,-m32)
 else
 tool-archpref          = $(64bit-tool-archpref)
 UTS_MACHINE            := loongarch64
+cflags-y               += $(call cc-option,-m64)
 endif
 
 ifneq ($(SUBARCH),$(ARCH))
index 42aa96249828c9eda4559060efe878da9d51930c..9c9181bb40715bf4797ba1ed8ae5cec03ab1bc43 100644 (file)
@@ -12,6 +12,8 @@ obj-vdso-$(CONFIG_GENERIC_GETTIMEOFDAY) += vgettimeofday.o
 ccflags-vdso := \
        $(filter -I%,$(KBUILD_CFLAGS)) \
        $(filter -E%,$(KBUILD_CFLAGS)) \
+       $(filter -m32,$(KBUILD_CFLAGS)) \
+       $(filter -m64,$(KBUILD_CFLAGS)) \
        $(filter -march=%,$(KBUILD_CFLAGS)) \
        $(filter -m%-float,$(KBUILD_CFLAGS)) \
        $(CLANG_FLAGS) \