[PATCH] powerpc: e500: Fix compilation with gcc e500 compiler

Pali Rohár pali at kernel.org
Wed May 25 05:16:10 AEST 2022


On Tuesday 24 May 2022 13:52:47 Segher Boessenkool wrote:
> On Tue, May 24, 2022 at 08:12:55PM +0200, Pali Rohár wrote:
> > On Tuesday 24 May 2022 12:59:55 Segher Boessenkool wrote:
> > > On Tue, May 24, 2022 at 11:39:39AM +0200, Pali Rohár wrote:
> > > > gcc e500 compiler does not support -mcpu=powerpc option. When it is
> > > > specified then gcc throws compile error:
> > > > 
> > > >   gcc: error: unrecognized argument in option ‘-mcpu=powerpc’
> > > >   gcc: note: valid arguments to ‘-mcpu=’ are: 8540 8548 native
> > > 
> > > What?  Are you using some modified version of GCC, perhaps?
> > 
> > Hello! I'm using official gcc version, no special modification.
> > 
> > > No version of GCC that isn't hamstrung can have this output.
> > 
> > gcc for e500 cores has really this output when you pass -mcpu=powerpc.
> > 
> > Upstream gcc dropped support for e500 cores during development of
> > version 9.
> 
> This isn't true.  The SPE instruction extension is no longer supported
> (because it wasn't maintained).  Everything else still works.
>
> > But you can still compile and install gcc 8.5.0 (last version
> > of gcc 8) which has this full e500 support.
> > 
> > Really, you can easily try it. Debian 10 (Buster) has gcc 8.3.0 in its
> > default installation and also provides packages with cross compilers.
> > Just run 'sudo apt install gcc-powerpc-linux-gnuspe' on desktop amd64
> > version of Debian 10, it will install e500 cross compiler.
> > 
> > -mcpu=8540 specify e500v1 and -mcpu=8548 specify e500v2
> 
> Aha.  Right, because this config forces -mspe it requires one of these
> CPUs.
> 
> You can use a powerpc-linux compiler instead, and everything will just
> work.  These CPUs are still supported, in all of GCC 9 .. GCC 12 :-)
> 
> 
> Segher

Ok. I can use different "generic" powerpc compiler (It should work fine
as you said, as it has also -mcpu=8540 option). But I think that
compilation of kernel should be supported also by that gcc 8.5.0 e500
compiler.

It is really annoying if for compiling kernel is needed different
compiler than for compiling rest of the system (userspace and
bootloader). And for user applications it should be really used e500
SPE-capable compiler due to performance reasons.


More information about the Linuxppc-dev mailing list