Re: Regression of GCC >= 4.8.5 for 32-bit powerpc

Rin Okuyama <[email protected]> Mon, 12 Dec 2016 05:26:45 +0900
Newsgroups gmane.os.netbsd.ports.powerpc,gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
Hi, thank you for your prompt response!

On 2016/12/11 14:34, Matt Thomas wrote:
>> On Dec 10, 2016, at 9:44 AM, Rin Okuyama <[email protected]> wrote:
>>
>> GCC >= 4.8.5 passes ".machine ppc" pseudo-op to assembler for 32-bit
>> powerpc:
>>
>> @@ -5199,10 +5204,8 @@
>> 	fputs ("power5\n", asm_out_file);
>>       else if ((rs6000_isa_flags & OPTION_MASK_MFCRF) != 0)
>> 	fputs ("power4\n", asm_out_file);
>> -      else if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) != 0)
>> -	fputs ("ppc64\n", asm_out_file);
>>       else
>> -	fputs ("ppc\n", asm_out_file);
>> +	fputs ("ppc64\n", asm_out_file);
>>     }
>> #endif
>> ====
>> Could I commit this patch? Any comments or suggestions?
>
> Is that fragment needed?  It doesn't seem to matter if you emit -mcpu=
> so why change it?

Yes, it is needed. ".machine ppc" pseudo-op  overrides CPU type
specified by -mcpu=XXX option. As a result, even if we emit
-mcpu=XXX, gas assembles mnemonics into instructions for generic
powerpc.

Actually, Makefile for IBM 405 specifies -mcpu=405:

src/sys/arch/evbppc/conf/Makefile.obs405.inc
      3  CFLAGS+=-mcpu=405
      4  AFLAGS+=-mcpu=405

But it is neglected by assembler for the above reason. To avoid
this, we need to stop GCC emitting ".machine ppc" pseudo-op.

Thanks,
Rin
----
P.S. I've sent a problem report to GCC:

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78764