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

From: Michael Ellerman
Date: Mon Jul 04 2022 - 06:25:30 EST




On 2 July 2022 7:44:05 pm AEST, "Pali Rohár" <pali@xxxxxxxxxx> wrote:
>On Tuesday 24 May 2022 11:39:39 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
>>
>> So do not set -mcpu=powerpc option when CONFIG_E500 is set. Correct option
>> -mcpu=8540 for CONFIG_E500 is set few lines below in that Makefile.
>>
>> Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
>> Cc: stable@xxxxxxxxxxxxxxx
>
>Michael, do you have any objections about this patch?

I don't particularly like it :)

>From the discussion with Segher, it sounds like this is a problem with a specific build of gcc that you're using, not a general problem with gcc built with e500 support.

Keying it off CONFIG_E500 means it will fix your problem, but not anyone else who has a different non-e500 compiler that also doesn't support -mcpu=powerpc (for whatever reason).

So I wonder if a better fix is to use cc-option when setting -mcpu=powerpc.

cheers