[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54407c50552a72c6f1e482cb71ce2a9b733038b6.camel@perches.com>
Date: Tue, 21 Aug 2018 10:20:29 -0700
From: Joe Perches <joe@...ches.com>
To: Masahiro Yamada <yamada.masahiro@...ionext.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Jonathan Corbet <corbet@....net>,
Arnd Bergmann <arnd@...db.de>,
David Woodhouse <dwmw@...zon.co.uk>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will.deacon@....com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] compiler-gcc: get back Clang build
On Wed, 2018-08-22 at 02:13 +0900, Masahiro Yamada wrote:
> Hi Joe,
>
>
> 2018-08-21 19:39 GMT+09:00 Joe Perches <joe@...ches.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.
Then those attributes should be added or
overridden in compiler-clang.h.
Powered by blists - more mailing lists