linux/arch/mips
Huacai Chen ecd9da1d05 MIPS: Loongson: Fix build error when make modules_install
[ Upstream commit 531b3d1195 ]

After commit 0e96ea5c3e ("MIPS: Loongson64: Clean up use of
cc-ifversion") we get a build error when make modules_install:

cc1: error: '-mloongson-mmi' must be used with '-mhard-float'

The reason is when make modules_install, 'call cc-option' doesn't work
in $(KBUILD_CFLAGS) of 'CHECKFLAGS'. Then there is no -mno-loongson-mmi
applied and -march=loongson3a enable MMI instructions.

To be detail, the error message comes from the CHECKFLAGS invocation of
$(CC) but it has no impact on the final result of make modules_install,
it is purely a cosmetic issue. The error occurs because cc-option is
defined in scripts/Makefile.compiler, which is not included in Makefile
when running 'make modules_install', as install targets are not supposed
to require the compiler; see commit 805b2e1d42 ("kbuild: include
Makefile.compiler only when compiler is needed"). As a result, the call
to check for '-mno-loongson-mmi' just never happens.

Fix this by partially reverting to the old logic, use 'call cc-option'
to conditionally apply -march=loongson3a and -march=mips64r2.

By the way, Loongson-2E/2F is also broken in commit 13ceb48bc1
("MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls") so fix it
together.

Fixes: 13ceb48bc1 ("MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls")
Fixes: 0e96ea5c3e ("MIPS: Loongson64: Clean up use of cc-ifversion")
Cc: stable@vger.kernel.org
Cc: Feiyang Chen <chenfeiyang@loongson.cn>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-03 10:23:50 +02:00
..
alchemy MIPS: Alchemy: fix dbdma2 2023-06-21 16:00:53 +02:00
ar7
ath25
ath79
bcm47xx
bcm63xx
bmips mips: bmips: BCM6358: disable RAC flush for TP1 2023-04-06 12:10:42 +02:00
boot
cavium-octeon
cobalt
configs
crypto
dec
fw MIPS: fw: Allow firmware to pass a empty env 2023-05-11 23:03:01 +09:00
generic
include MIPS: dec: prom: Address -Warray-bounds warning 2023-07-27 08:50:33 +02:00
ingenic
jazz
kernel MIPS: Loongson: Fix cpu_probe_loongson() again 2023-07-23 13:49:33 +02:00
kvm MIPS: kvm: Fix build error with KVM_MIPS_DEBUG_COP0_COUNTERS enabled 2023-07-23 13:49:50 +02:00
lantiq
lib
loongson2ef MIPS: Loongson: Move arch cflags to MIPS top level Makefile 2023-08-03 10:23:50 +02:00
loongson32
loongson64 MIPS: Loongson: Move arch cflags to MIPS top level Makefile 2023-08-03 10:23:50 +02:00
math-emu
mm mips/mm: Convert to using lock_mm_and_find_vma() 2023-07-01 13:16:24 +02:00
mti-malta
n64
net
pci
pic32
power
ralink
rb532
sgi-ip22
sgi-ip27
sgi-ip30
sgi-ip32
sibyte
sni
tools
txx9
vdso
Kbuild
Kbuild.platforms
Kconfig mips/mm: Convert to using lock_mm_and_find_vma() 2023-07-01 13:16:24 +02:00
Kconfig.debug
Makefile MIPS: Loongson: Fix build error when make modules_install 2023-08-03 10:23:50 +02:00
Makefile.postlink