On Tue, 7 Feb 2023, Guillaume Tucker wrote: > After some investigation, it turns out the error happens when > doing "make modules_install". Here's the issue: > > * modules_install is listed in "no-compiler-targets" in the > top-level Makefile > > * as a result, scripts/Makefile.compiler is not included > > * arch/mips/loongson64/Platform requires the "cc-option" function > to add -mnon-loongson-mmi > > * since "cc-option" is not defined when just doing "make > modules_install", the flag is not added and the error mentioned > above occurs > > GitHub issue: https://github.com/kernelci/kernelci-project/issues/176 > > Here's a hack to prove this point, need-compiler is defined in > the top-level Makefile so it shouldn't be used here but > this "fixes" the problem: > > > > diff --git a/arch/mips/Makefile b/arch/mips/Makefile > index 490dea07d4e0..024f62dbef76 100644 > --- a/arch/mips/Makefile > +++ b/arch/mips/Makefile > @@ -317,10 +317,12 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables > KBUILD_LDFLAGS += -m $(ld-emul) > > ifdef CONFIG_MIPS > +ifdef need-compiler > CHECKFLAGS += $(shell $(CC) $(KBUILD_CFLAGS) -dM -E -x c /dev/null | \ > grep -E -vw '__GNUC_(MINOR_|PATCHLEVEL_)?_' | \ > sed -e "s/^\#define /-D'/" -e "s/ /'='/" -e "s/$$/'/" -e 's/\$$/&&/g') > endif > +endif I think it is actually the proper way, and if this gets a go-ahead, then all you need is to replace `CONFIG_MIPS' with `need-compiler' in the existing conditional, as the very purpose of this conditional is to guard the assignment against being invoked, except for `no-dot-config-targets' only (as discussed here: <https://lore.kernel.org/all/1675328702-8328-1-git-send-email-yangtiezhu@xxxxxxxxxxx/> as recently as last week) rather than all of `no-compiler-targets'. Evidently that is not enough, but please mind that with embedded targets people often do not use modules and therefore do not trip over issues with `make modules_install'. This should probably be marked with: Fixes: 13ceb48bc19c ("MIPS: Loongson2ef: Remove unnecessary {as,cc}-option calls") as it's when `-march=loongson2f' (which implies `-mloongson-mmi') started being added unconditionally (and then `-march=loongson3a' followed with commit 0e96ea5c3eb5 ("MIPS: Loongson64: Clean up use of cc-ifversion")). Nick, I'm afraid these were both your stuff. Also Loongson targets have their dedicated platform maintainers (cc-ed) and general MIPS maintainers may pay less attention to such issues. FWIW and HTH, Maciej