Skip to content

Commit 5643c6b

Browse files
committed
LoongArch: Specify -m32/-m64 explicitly for 32BIT/64BIT
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>
1 parent 4808e5c commit 5643c6b

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

arch/loongarch/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ endif
5555
ifdef CONFIG_32BIT
5656
tool-archpref = $(32bit-tool-archpref)
5757
UTS_MACHINE := loongarch32
58+
cflags-y += $(call cc-option,-m32)
5859
else
5960
tool-archpref = $(64bit-tool-archpref)
6061
UTS_MACHINE := loongarch64
62+
cflags-y += $(call cc-option,-m64)
6163
endif
6264

6365
ifneq ($(SUBARCH),$(ARCH))

arch/loongarch/vdso/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ obj-vdso-$(CONFIG_GENERIC_GETTIMEOFDAY) += vgettimeofday.o
1212
ccflags-vdso := \
1313
$(filter -I%,$(KBUILD_CFLAGS)) \
1414
$(filter -E%,$(KBUILD_CFLAGS)) \
15+
$(filter -m32,$(KBUILD_CFLAGS)) \
16+
$(filter -m64,$(KBUILD_CFLAGS)) \
1517
$(filter -march=%,$(KBUILD_CFLAGS)) \
1618
$(filter -m%-float,$(KBUILD_CFLAGS)) \
1719
$(CLANG_FLAGS) \

0 commit comments

Comments
 (0)