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

From: Nick Desaulniers
Date: Mon Aug 16 2021 - 16:11:23 EST


On Mon, Aug 16, 2021 at 1:06 PM 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:
> > >
> > > diff --git a/Makefile b/Makefile
> > > index 027fdf2a14fe..3e3fb4affba1 100644
> > > --- a/Makefile
> > > +++ b/Makefile
> > > @@ -798,7 +801,7 @@ include/config/auto.conf:
> > > endif # may-sync-config
> > > endif # need-config
> > >
> > > -KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
> > > +KBUILD_CFLAGS += -fno-delete-null-pointer-checks
> > > KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
> > > KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation)
> > > KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow)
> > > @@ -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
>
> So it looks like `-fallow-store-data-races` was also supported. Reading through
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97309
> https://gcc.gnu.org/wiki/Atomic/GCCMM/ExecutiveSummary
> it seems that the default is not to allow "store data races." So I
> should not be adding `--allow-store-data-races` or
> `-fallow-store-data-races`; so this just should be the existing test,
> with a comment that it can be removed once gcc-10+ is the minimum.
> Will update that in v2.

Ah, perhaps I should combine the following line:
KBUILD_CFLAGS += $(call
cc-option,-fallow-store-data-races,--param=allow-store-data-races=0)

Though I don't understand the csky failure. cc-option appends to a
running list of flags; if an unsupported flag gets added to CFLAGS, it
can cause cc-option to failure subsequent checks in spooky ways. I
usually debug those by adding print statements to cc-option to see
what the full command it's testing; then invoke the compiler manually
with those to see what went wrong. (bookmarked and referenced often:
https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile)

Though my distro doesn't package csky-linux-gnu-gcc...
--
Thanks,
~Nick Desaulniers