From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Joe Perches <joe@perches.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Jonathan Corbet <corbet@lwn.net>, Arnd Bergmann <arnd@arndb.de>,
David Woodhouse <dwmw@amazon.co.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Will Deacon <will.deacon@arm.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] compiler-gcc: get back Clang build
Date: Wed, 22 Aug 2018 02:13:51 +0900 [thread overview]
Message-ID: <CAK7LNAT39aFpgs0iAudYwpA4x6+B_8WZ0ftQ2Mff3-cTOd3Diw@mail.gmail.com> (raw)
In-Reply-To: <7bbf0a3c97f817c81df2316fca0ec88d5a6b4302.camel@perches.com>
Hi Joe,
2018-08-21 19:39 GMT+09:00 Joe Perches <joe@perches.com>:
> On Tue, 2018-08-21 at 15:48 +0900, Masahiro Yamada wrote:
>> Commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6")
>> missed the fact that <linux/compiler-gcc.h> is included by Clang
>> as well as by GCC.
>>
>> Clang actually defines __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__
>> and it looks like GCC 4.2.1.
>>
>> $ scripts/gcc-version.sh -p clang
>> 040201
>
> Perhaps this would work, but I can't test it as
> my clang version doesn't otherwise build a defconfig
> and errors out with
>
> $ make CC=clang
> arch/x86/Makefile:179: *** Compiler lacks asm-goto support.. Stop.
>
> ---
> include/linux/compiler-gcc.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index 3e70b7d4e9ed..3a06ad823fa4 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -3,6 +3,23 @@
> #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
> #endif
>
> +/*
> + * Override clang compiler version #defines
> + *
> + * compiler_types.h always #includes compiler-gcc.h before compiler-clang,h
> + * but clang sets these __GNUC version #defines to 4.2.1.
> + * This breaks the gcc minimum version of 4.6.0, so override the clang
> + * definitions to 4.6.0
> + */
> +#ifdef __clang__
> + #undef __GNUC__
> + #undef __GNUC_MINOR__
> + #undef __GNUC_PATCHLEVEL__
> + #define __GNUC__ 4
> + #define __GNUC_MINOR__ 6
> + #define __GNUC_PATCHLEVEL__ 0
> +#endif
> +
>
This patch does not work.
It only addresses the
"# error Sorry, your compiler is too old - please upgrade it." part.
Attributes unsupported by Clang
must be ifdef'ed out.
Otherwise, you will see lots of unknown attribute warnings.
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2018-08-21 17:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-21 6:48 Masahiro Yamada
2018-08-21 8:09 ` Nick Desaulniers
2018-08-21 10:39 ` Joe Perches
2018-08-21 16:35 ` Nick Desaulniers
2018-08-21 17:13 ` Masahiro Yamada [this message]
2018-08-21 17:20 ` Joe Perches
2018-08-21 12:38 ` Dominique Martinet
2018-08-21 16:32 ` Nick Desaulniers
2018-08-21 16:45 ` Joe Perches
2018-08-21 17:00 ` Nick Desaulniers
2018-08-22 4:16 ` Dominique Martinet
2018-08-22 4:22 ` Joe Perches
2018-08-22 4:32 ` Dominique Martinet
2018-08-22 18:31 ` Nick Desaulniers
2018-08-22 19:01 ` Nick Desaulniers
2018-08-22 20:50 ` Joe Perches
2018-08-22 23:05 ` Nick Desaulniers
2018-08-22 23:32 ` Joe Perches
2018-08-22 23:57 ` Dominique Martinet
2018-08-21 16:33 ` Joe Perches
2018-08-21 16:57 ` Nick Desaulniers
2018-08-21 17:22 ` Joe Perches
2018-08-21 17:07 ` Masahiro Yamada
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=CAK7LNAT39aFpgs0iAudYwpA4x6+B_8WZ0ftQ2Mff3-cTOd3Diw@mail.gmail.com \
--to=yamada.masahiro@socionext.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=corbet@lwn.net \
--cc=dwmw@amazon.co.uk \
--cc=geert@linux-m68k.org \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ndesaulniers@google.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.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
all inboxes | Powered by JetHome®