Re: [PATCH] Makefile: remove stale cc-option checks

From: Masahiro Yamada
Date: Mon Aug 16 2021 - 21:39:52 EST


On Tue, Aug 17, 2021 at 9:16 AM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> On Tue, Aug 17, 2021 at 3:36 AM Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx> wrote:
> >
> > On Fri, Aug 13, 2021 at 6:43 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
> > >
> > > On Wed, Aug 11, 2021 at 5:42 AM Nick Desaulniers
> > > <ndesaulniers@xxxxxxxxxx> wrote:
> > > >
> > > > --param=allow-store-data-races=0 was renamed to --allow-store-data-races
> > > > in the GCC 10 release.
> > > >
> > > > diff --git a/Makefile b/Makefile
> > > > index 027fdf2a14fe..3e3fb4affba1 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -844,17 +847,17 @@ KBUILD_RUSTFLAGS += -Copt-level=z
> > > > endif
> > > >
> > > > # Tell gcc to never replace conditional load with a non-conditional one
> > > > -KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
> > > > +ifdef CONFIG_CC_IS_GCC
> > >
> > >
> > > Can you insert a comment here?
> > >
> > > # GCC 10 renamed --param=allow-store-data-races=0 to --allow-store-data-races
> > >
> > >
> > > It will remind us of dropping this conditional
> > > in the (long long distant) future.
> > >
> > >
> > >
> > >
> > > > +KBUILD_CFLAGS += $(call cc-option,--allow-store-data-races,--param=allow-store-data-races=0)
> > > > KBUILD_CFLAGS += $(call cc-option,-fno-allow-store-data-races)
> > > > +endif
> >
> > This report is confusing:
> > https://lore.kernel.org/linux-mm/202108160729.Lx0IJzq3-lkp@xxxxxxxxx/
> > (csky gcc-11)
> >
> > >> csky-linux-gcc: error: unrecognized command-line option '--param=allow-store-data-races=0'; did you mean '--allow-store-data-races'?
> >
> > I wonder if cc-option detection for these is broken?
>
> I do not say it is broken...
>
>
> cc-option is defined like this:
>
> cc-option = $(call __cc-option, $(CC),\
> $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS),$(1),$(2))
>
>
> It is checking
> $(KBUILD_CPPFLAGS) + $(KBUILD_CFLAGS)
> + --allow-store-data-races
>
>
> A few lines above, I see
>
> csky-linux-gcc: error: unrecognized argument in option '-mcpu=ck860'
>
>
> It makes all the cc-option tests fail after this line:
> KBUILD_CFLAGS += -mcpu=$(CPUTYPE) -Wa,-mcpu=$(MCPU_STR)
>
>
> Then,
>
> $(call cc-option,--allow-store-data-races,--param=allow-store-data-races=0)
>
> falls back to --param=allow-store-data-races=0
>
>
>
>
> > Perhaps I should
> > not touch these other than to wrap them in the CONFIG_CC_IS_GCC guard?
>
> I do not think so.
>
> If an unrecognized argument appears,
> all the cc-option tests that follow are unreliable.
>
>
>
> If you are not comfortable with it,
> you can split it.
>
> KBUILD_CFLAGS += $(call cc-option,--allow-store-data-races)
> KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)


I read the patch in the wrong way.
This is the same as the current code.

So, your v2 is fine with me.
I will pick it up soon.





--
Best Regards
Masahiro Yamada