Message ID | 11D1B8A01F6006BF+20250214095523.175229-1-wangyuli@uniontech.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | MIPS: dec: Only check -msym32 when need compiler | expand |
On Fri, 14 Feb 2025, WangYuli wrote: > During make modules_install, the need-compiler variable becomes null, > so Makefile.compiler isn't included. > > This results in call cc-option-yn returning nothing. > > To get rid of spurious "CONFIG_CPU_DADDI_WORKAROUNDS unsupported > without -msym32" error, just wrap it into `ifdef need-compiler'. I think this needs to say explicitly that `make modules_install' is one of the targets that does not require or use the compiler and consequently does not require compilation flag variables such as `cflags-y' either. Therefore this target sets `need-compiler' to nil so as to disable all the unnecessary compiler logic and we can also use it here for this purpose, avoiding triggering logic that does rely on the compiler which is only needed at the compilation stage. Otherwise the unfamiliar reader will still have to guess why it is safe to exclude this part as it's not mentioned explicitly. See the second paragraph of the change description of commit 4fe4a6374c4d ("MIPS: Only fiddle with CHECKFLAGS if `need-compiler'") for justification I gave for the use of `need-compiler' there. > diff --git a/arch/mips/Makefile b/arch/mips/Makefile > index be8cb44a89fd..4d8339d2f20f 100644 > --- a/arch/mips/Makefile > +++ b/arch/mips/Makefile > @@ -304,8 +304,12 @@ ifdef CONFIG_64BIT > ifeq ($(KBUILD_SYM32), y) > cflags-$(KBUILD_SYM32) += -msym32 -DKBUILD_64BIT_SYM32 > else > - ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y) > - $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32) > +# Do not fiddle with the compilation flags when no compiler is > +# going to be used. To get rid of spurious errors. > + ifdef need-compiler > + ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y) > + $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32) > + endif > endif > endif > endif The comment is not correctly aligned with code here, but as I say I don't think it's really needed in the first place and then the `ifdef' ought to wrap the whole conditional for clarity, because none of this stuff is used (and then the call to `cc-option-yn' as you say will always yield nothing, because the variable will not have been defined). Maciej
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index be8cb44a89fd..4d8339d2f20f 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -304,8 +304,12 @@ ifdef CONFIG_64BIT ifeq ($(KBUILD_SYM32), y) cflags-$(KBUILD_SYM32) += -msym32 -DKBUILD_64BIT_SYM32 else - ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y) - $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32) +# Do not fiddle with the compilation flags when no compiler is +# going to be used. To get rid of spurious errors. + ifdef need-compiler + ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y) + $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32) + endif endif endif endif