From: Kees Cook <keescook@chromium.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Sedat Dilek <sedat.dilek@gmail.com>,
Nathan Chancellor <natechancellor@gmail.com>,
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Marco Elver <elver@google.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Randy Dunlap <rdunlap@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Sami Tolvanen <samitolvanen@google.com>,
linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com
Subject: Re: [PATCH] compiler-clang: add build check for clang 10.0.1
Date: Wed, 26 Aug 2020 14:01:24 -0700 [thread overview]
Message-ID: <202008261356.B31349A@keescook> (raw)
In-Reply-To: <20200826201420.3414123-1-ndesaulniers@google.com>
On Wed, Aug 26, 2020 at 01:14:19PM -0700, Nick Desaulniers wrote:
> During Plumbers 2020, we voted to just support the latest release of
> Clang for now. Add a compile time check for this.
>
> Older clang's may work, but we will likely drop workarounds for older
> versions.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/9
> Link: https://github.com/ClangBuiltLinux/linux/issues/941
> Suggested-by: Sedat Dilek <sedat.dilek@gmail.com>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> include/linux/compiler-clang.h | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
> index cee0c728d39a..7338d3ffd240 100644
> --- a/include/linux/compiler-clang.h
> +++ b/include/linux/compiler-clang.h
> @@ -3,6 +3,14 @@
> #error "Please don't include <linux/compiler-clang.h> directly, include <linux/compiler.h> instead."
> #endif
>
> +#define CLANG_VERSION (__clang_major__ * 10000 \
> + + __clang_minor__ * 100 \
> + + __clang_patchlevel__)
> +
> +#if CLANG_VERSION < 100001
> +# error Sorry, your compiler is too old - please upgrade it.
Perhaps a bike-shed suggestion, but I think we should make this message
as specific (and helpful) as possible:
# error Sorry, your version of Clang is too old - please use 10.0.1 or newer.
Then anyone seeing this has several pieces of information:
- the kernel build was attempting to use Clang
(maybe they accidentally poked the wrong configs in a CI)
- they need 10.0.1 or better
("upgrade to what version?" doesn't need to be dug out of documentation,
headers, etc)
With that, yes, let's do it. :)
Reviewed-by: Kees Cook <keescook@chromium.org>
(And likely we should improve the GCC message at the same time...)
--
Kees Cook
next prev parent reply other threads:[~2020-08-26 21:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 20:14 [PATCH] compiler-clang: add build check for clang 10.0.1 Nick Desaulniers
2020-08-26 21:01 ` Kees Cook [this message]
2020-08-27 7:16 ` Sedat Dilek
2020-08-26 21:17 ` Miguel Ojeda
2020-08-26 21:26 ` Nathan Chancellor
2020-08-27 7:19 ` Sedat Dilek
2020-08-26 21:42 ` Nathan Chancellor
2020-08-27 19:02 ` Marco Elver
2020-08-28 10:54 ` Andrey Konovalov
2020-08-31 23:32 ` Nick Desaulniers
2020-08-31 23:36 ` Nick Desaulniers
2020-08-27 7:22 ` Sedat Dilek
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=202008261356.B31349A@keescook \
--to=keescook@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=clang-built-linux@googlegroups.com \
--cc=elver@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=mingo@kernel.org \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=samitolvanen@google.com \
--cc=sedat.dilek@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox