From: Masahiro Yamada <masahiroy@kernel.org> To: Nick Desaulniers <ndesaulniers@google.com> Cc: Michal Marek <michal.lkml@markovi.net>, Nathan Chancellor <nathan@kernel.org>, Andrew Morton <akpm@linux-foundation.org>, "Paul E. McKenney" <paulmck@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Miguel Ojeda <ojeda@kernel.org>, Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>, Vitor Massaru Iha <vitor@massaru.org>, Sedat Dilek <sedat.dilek@gmail.com>, Daniel Latypov <dlatypov@google.com>, Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, clang-built-linux <clang-built-linux@googlegroups.com> Subject: Re: [PATCH] Makefile: remove stale cc-option checks Date: Sat, 14 Aug 2021 10:42:31 +0900 [thread overview] Message-ID: <CAK7LNASotywVkNjaBC7wYke70QL+a0tMJEVEvRTPpt8dDgHE9Q@mail.gmail.com> (raw) In-Reply-To: <20210810204240.4008685-1-ndesaulniers@google.com> On Wed, Aug 11, 2021 at 5:42 AM Nick Desaulniers <ndesaulniers@google.com> wrote: > > cc-option, cc-option-yn, and cc-disable-warning all invoke the compiler > during build time, and can slow down the build when these checks become > stale for our supported compilers, whose minimally supported versions > increases over time. See Documentation/process/changes.rst for the > current supported minimal versions (GCC 4.9+, clang 10.0.1+). Compiler > version support for these flags may be verified on godbolt.org. > > The following flags are GCC only and supported since at least GCC 4.9. > Remove cc-option and cc-disable-warning tests. > * -fno-tree-loop-im > * -Wno-maybe-uninitialized > * -fno-reorder-blocks > * -fno-ipa-cp-clone > * -fno-partial-inlining > * -femit-struct-debug-baseonly > * -fno-inline-functions-called-once > * -fconserve-stack > > The following flags are supported by all supported versions of GCC and > Clang. Remove their cc-option, cc-option-yn, and cc-disable-warning tests. > * -fno-delete-null-pointer-checks > * -fno-var-tracking > * -mfentry > * -Wno-array-bounds > > The following configs are made dependent on GCC, since they use GCC > specific flags. > * READABLE_ASM > * DEBUG_SECTION_MISMATCH > > --param=allow-store-data-races=0 was renamed to --allow-store-data-races > in the GCC 10 release. > > Also, base RETPOLINE_CFLAGS and RETPOLINE_VDSO_CFLAGS on CONFIC_CC_IS_* > then remove cc-option tests for Clang. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1436 > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> > --- > Note: It may be preferred to move the test for > -fno-inline-functions-called-once for DEBUG_SECTION_MISMATCH into > Kconfig. That one does seem relatively more reasonable to implement in > Clang. > > Makefile | 55 ++++++++++++++++++++++++++--------------------- > lib/Kconfig.debug | 2 ++ > 2 files changed, 33 insertions(+), 24 deletions(-) > > diff --git a/Makefile b/Makefile > index 027fdf2a14fe..3e3fb4affba1 100644 > --- a/Makefile > +++ b/Makefile > @@ -730,9 +730,10 @@ endif # KBUILD_EXTMOD > # Defaults to vmlinux, but the arch makefile usually adds further targets > all: vmlinux > > -CFLAGS_GCOV := -fprofile-arcs -ftest-coverage \ > - $(call cc-option,-fno-tree-loop-im) \ > - $(call cc-disable-warning,maybe-uninitialized,) > +CFLAGS_GCOV := -fprofile-arcs -ftest-coverage > +ifdef CONFIG_CC_IS_GCC > +CFLAGS_GCOV += -fno-tree-loop-im > +endif > export CFLAGS_GCOV > > # The arch Makefiles can override CC_FLAGS_FTRACE. We may also append it later. > @@ -740,12 +741,14 @@ ifdef CONFIG_FUNCTION_TRACER > CC_FLAGS_FTRACE := -pg > endif > > -RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register > -RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-inline -mindirect-branch-register > -RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk > -RETPOLINE_VDSO_CFLAGS_CLANG := -mretpoline > -RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) > -RETPOLINE_VDSO_CFLAGS := $(call cc-option,$(RETPOLINE_VDSO_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_VDSO_CFLAGS_CLANG))) > +ifdef CONFIG_CC_IS_GCC > +RETPOLINE_CFLAGS := $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register) > +RETPOLINE_VDSO_CFLAGS := $(call cc-option,-mindirect-branch=thunk-inline -mindirect-branch-register) > +endif > +ifdef CONFIG_CC_IS_CLANG > +RETPOLINE_CFLAGS := -mretpoline-external-thunk > +RETPOLINE_VDSO_CFLAGS := -mretpoline > +endif > export RETPOLINE_CFLAGS > export RETPOLINE_VDSO_CFLAGS > > @@ -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 > -- Best Regards Masahiro Yamada
next prev parent reply other threads:[~2021-08-14 1:43 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-10 20:42 Nick Desaulniers 2021-08-10 23:01 ` Nathan Chancellor 2021-08-14 1:33 ` Masahiro Yamada 2021-08-11 10:41 ` Miguel Ojeda 2021-08-14 1:42 ` Masahiro Yamada [this message] 2021-08-16 18:35 ` Nick Desaulniers 2021-08-17 0:16 ` Masahiro Yamada 2021-08-17 1:38 ` Masahiro Yamada 2021-08-16 20:06 ` Nick Desaulniers 2021-08-16 20:11 ` Nick Desaulniers 2021-08-14 11:02 ` Naresh Kamboju 2021-08-16 18:37 ` Nick Desaulniers 2021-08-16 23:31 ` Stephen Rothwell
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAK7LNASotywVkNjaBC7wYke70QL+a0tMJEVEvRTPpt8dDgHE9Q@mail.gmail.com \ --to=masahiroy@kernel.org \ --cc=akpm@linux-foundation.org \ --cc=clang-built-linux@googlegroups.com \ --cc=dlatypov@google.com \ --cc=linux-kbuild@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=michal.lkml@markovi.net \ --cc=nathan@kernel.org \ --cc=ndesaulniers@google.com \ --cc=ojeda@kernel.org \ --cc=paulmck@kernel.org \ --cc=penguin-kernel@i-love.sakura.ne.jp \ --cc=peterz@infradead.org \ --cc=sedat.dilek@gmail.com \ --cc=vitor@massaru.org \ --subject='Re: [PATCH] Makefile: remove stale cc-option checks' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).