diff mbox series

[v1,5/5] powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')

Message ID 77255a5a957967723b84d0356d9e5fb21569f4e8.1657549153.git.christophe.leroy@csgroup.eu (mailing list archive)
State Accepted
Headers show
Series [v1,1/5] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32 | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.
snowpatch_ozlabs/github-powerpc_clang fail kernel (ppc44x, ubuntu-21.10, ppc64) failed at step build.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.

Commit Message

Christophe Leroy July 11, 2022, 2:19 p.m. UTC
With GCC 12, corenet64_smp_defconfig leads to the following build errors:

  CC      arch/powerpc/kernel/irq.o
{standard input}: Assembler messages:
{standard input}:3616: Error: unrecognized opcode: `wrteei'
{standard input}:5689: Error: unrecognized opcode: `wrteei'
  CC      arch/powerpc/kernel/pmc.o
{standard input}: Assembler messages:
{standard input}:42: Error: unrecognized opcode: `mfpmr'
{standard input}:53: Error: unrecognized opcode: `mtpmr'
  CC      arch/powerpc/kernel/io.o
{standard input}: Assembler messages:
{standard input}:376: Error: unrecognized opcode: `mbar'
...
  CC      arch/powerpc/mm/nohash/book3e_hugetlbpage.o
{standard input}: Assembler messages:
{standard input}:291: Error: unrecognized opcode: `tlbsx'
{standard input}:482: Error: unrecognized opcode: `tlbwe'
{standard input}:608: Error: unrecognized opcode: `lbarx'
{standard input}:608: Error: unrecognized opcode: `stbcx.'

-mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.

But then we get:

  CC      arch/powerpc/lib/xor_vmx.o
cc1: error: AltiVec not supported in this target

Altivec is not supported with -mcpu=e5500 so don't allow selection
of altivec when e5500 is selected.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/Makefile                  | 8 +-------
 arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
 2 files changed, 5 insertions(+), 11 deletions(-)

Comments

Pali Rohár Dec. 11, 2022, 5:32 p.m. UTC | #1
On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
> 
>   CC      arch/powerpc/kernel/irq.o
> {standard input}: Assembler messages:
> {standard input}:3616: Error: unrecognized opcode: `wrteei'
> {standard input}:5689: Error: unrecognized opcode: `wrteei'
>   CC      arch/powerpc/kernel/pmc.o
> {standard input}: Assembler messages:
> {standard input}:42: Error: unrecognized opcode: `mfpmr'
> {standard input}:53: Error: unrecognized opcode: `mtpmr'
>   CC      arch/powerpc/kernel/io.o
> {standard input}: Assembler messages:
> {standard input}:376: Error: unrecognized opcode: `mbar'
> ...
>   CC      arch/powerpc/mm/nohash/book3e_hugetlbpage.o
> {standard input}: Assembler messages:
> {standard input}:291: Error: unrecognized opcode: `tlbsx'
> {standard input}:482: Error: unrecognized opcode: `tlbwe'
> {standard input}:608: Error: unrecognized opcode: `lbarx'
> {standard input}:608: Error: unrecognized opcode: `stbcx.'
> 
> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
> 
> But then we get:
> 
>   CC      arch/powerpc/lib/xor_vmx.o
> cc1: error: AltiVec not supported in this target
> 
> Altivec is not supported with -mcpu=e5500 so don't allow selection
> of altivec when e5500 is selected.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  arch/powerpc/Makefile                  | 8 +-------
>  arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
>  2 files changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index d54e1fe03551..02742facf895 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -168,13 +168,7 @@ endif
>  CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>  AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>  
> -# Altivec option not allowed with e500mc64 in GCC.
> -ifdef CONFIG_ALTIVEC
> -E5500_CPU := -mcpu=powerpc64
> -else
> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> -endif
> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>  CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))

Hello! I think that there is an issue. After removal of E5500_CPU
variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
assignment, because it is empty.

>  
>  asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index 3cc8452b8660..5185d942b455 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -126,12 +126,12 @@ choice
>  
>  config GENERIC_CPU
>  	bool "Generic (POWER4 and above)"
> -	depends on PPC64 && !CPU_LITTLE_ENDIAN
> -	select PPC_64S_HASH_MMU if PPC_BOOK3S_64
> +	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
> +	select PPC_64S_HASH_MMU
>  
>  config GENERIC_CPU
>  	bool "Generic (POWER8 and above)"
> -	depends on PPC64 && CPU_LITTLE_ENDIAN
> +	depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
>  	select ARCH_HAS_FAST_MULTIPLIER
>  	select PPC_64S_HASH_MMU
>  
> @@ -358,7 +358,7 @@ config PHYS_64BIT
>  
>  config ALTIVEC
>  	bool "AltiVec Support"
> -	depends on PPC_BOOK3S_32 || PPC_BOOK3S_64 || (PPC_E500MC && PPC64)
> +	depends on PPC_BOOK3S || (PPC_E500MC && PPC64 && !E5500_CPU)
>  	select PPC_FPU
>  	help
>  	  This option enables kernel support for the Altivec extensions to the
> -- 
> 2.36.1
>
Christophe Leroy Dec. 12, 2022, 7:36 a.m. UTC | #2
Le 11/12/2022 à 18:32, Pali Rohár a écrit :
> On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
>> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>>
>>    CC      arch/powerpc/kernel/irq.o
>> {standard input}: Assembler messages:
>> {standard input}:3616: Error: unrecognized opcode: `wrteei'
>> {standard input}:5689: Error: unrecognized opcode: `wrteei'
>>    CC      arch/powerpc/kernel/pmc.o
>> {standard input}: Assembler messages:
>> {standard input}:42: Error: unrecognized opcode: `mfpmr'
>> {standard input}:53: Error: unrecognized opcode: `mtpmr'
>>    CC      arch/powerpc/kernel/io.o
>> {standard input}: Assembler messages:
>> {standard input}:376: Error: unrecognized opcode: `mbar'
>> ...
>>    CC      arch/powerpc/mm/nohash/book3e_hugetlbpage.o
>> {standard input}: Assembler messages:
>> {standard input}:291: Error: unrecognized opcode: `tlbsx'
>> {standard input}:482: Error: unrecognized opcode: `tlbwe'
>> {standard input}:608: Error: unrecognized opcode: `lbarx'
>> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>>
>> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>>
>> But then we get:
>>
>>    CC      arch/powerpc/lib/xor_vmx.o
>> cc1: error: AltiVec not supported in this target
>>
>> Altivec is not supported with -mcpu=e5500 so don't allow selection
>> of altivec when e5500 is selected.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   arch/powerpc/Makefile                  | 8 +-------
>>   arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
>>   2 files changed, 5 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>> index d54e1fe03551..02742facf895 100644
>> --- a/arch/powerpc/Makefile
>> +++ b/arch/powerpc/Makefile
>> @@ -168,13 +168,7 @@ endif
>>   CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>   AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>   
>> -# Altivec option not allowed with e500mc64 in GCC.
>> -ifdef CONFIG_ALTIVEC
>> -E5500_CPU := -mcpu=powerpc64
>> -else
>> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>> -endif
>> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
>> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>>   CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
> 
> Hello! I think that there is an issue. After removal of E5500_CPU
> variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
> assignment, because it is empty.
> 

Ah yes, you are right.

It should be fixed by 
https://github.com/linuxppc/linux/commit/f2636eaac7dee1d7d096cc115ff4f5111b0c508c

Michael, I see the patch is in next-test. Can you add:

Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12 
(unrecognized opcode: `wrteei')")


Thanks
Christophe
Michael Ellerman Dec. 12, 2022, 10:27 a.m. UTC | #3
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Le 11/12/2022 à 18:32, Pali Rohár a écrit :
>> On Monday 11 July 2022 16:19:33 Christophe Leroy wrote:
>>> With GCC 12, corenet64_smp_defconfig leads to the following build errors:
>>>
>>>    CC      arch/powerpc/kernel/irq.o
>>> {standard input}: Assembler messages:
>>> {standard input}:3616: Error: unrecognized opcode: `wrteei'
>>> {standard input}:5689: Error: unrecognized opcode: `wrteei'
>>>    CC      arch/powerpc/kernel/pmc.o
>>> {standard input}: Assembler messages:
>>> {standard input}:42: Error: unrecognized opcode: `mfpmr'
>>> {standard input}:53: Error: unrecognized opcode: `mtpmr'
>>>    CC      arch/powerpc/kernel/io.o
>>> {standard input}: Assembler messages:
>>> {standard input}:376: Error: unrecognized opcode: `mbar'
>>> ...
>>>    CC      arch/powerpc/mm/nohash/book3e_hugetlbpage.o
>>> {standard input}: Assembler messages:
>>> {standard input}:291: Error: unrecognized opcode: `tlbsx'
>>> {standard input}:482: Error: unrecognized opcode: `tlbwe'
>>> {standard input}:608: Error: unrecognized opcode: `lbarx'
>>> {standard input}:608: Error: unrecognized opcode: `stbcx.'
>>>
>>> -mpcu=powerpc64 cannot be used anymore for book3e, it must be a booke CPU.
>>>
>>> But then we get:
>>>
>>>    CC      arch/powerpc/lib/xor_vmx.o
>>> cc1: error: AltiVec not supported in this target
>>>
>>> Altivec is not supported with -mcpu=e5500 so don't allow selection
>>> of altivec when e5500 is selected.
>>>
>>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>>> ---
>>>   arch/powerpc/Makefile                  | 8 +-------
>>>   arch/powerpc/platforms/Kconfig.cputype | 8 ++++----
>>>   2 files changed, 5 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
>>> index d54e1fe03551..02742facf895 100644
>>> --- a/arch/powerpc/Makefile
>>> +++ b/arch/powerpc/Makefile
>>> @@ -168,13 +168,7 @@ endif
>>>   CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>>   AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
>>>   
>>> -# Altivec option not allowed with e500mc64 in GCC.
>>> -ifdef CONFIG_ALTIVEC
>>> -E5500_CPU := -mcpu=powerpc64
>>> -else
>>> -E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>>> -endif
>>> -CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
>>> +CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
>>>   CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
>> 
>> Hello! I think that there is an issue. After removal of E5500_CPU
>> variable few line above, it cannot be used in CFLAGS-$(CONFIG_E6500_CPU)
>> assignment, because it is empty.
>> 
>
> Ah yes, you are right.
>
> It should be fixed by 
> https://github.com/linuxppc/linux/commit/f2636eaac7dee1d7d096cc115ff4f5111b0c508c
>
> Michael, I see the patch is in next-test. Can you add:
>
> Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12 
> (unrecognized opcode: `wrteei')")

Yep, will do.

cheers
diff mbox series

Patch

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index d54e1fe03551..02742facf895 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -168,13 +168,7 @@  endif
 CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
 AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
 
-# Altivec option not allowed with e500mc64 in GCC.
-ifdef CONFIG_ALTIVEC
-E5500_CPU := -mcpu=powerpc64
-else
-E5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
-endif
-CFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
+CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
 CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
 
 asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 3cc8452b8660..5185d942b455 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -126,12 +126,12 @@  choice
 
 config GENERIC_CPU
 	bool "Generic (POWER4 and above)"
-	depends on PPC64 && !CPU_LITTLE_ENDIAN
-	select PPC_64S_HASH_MMU if PPC_BOOK3S_64
+	depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
+	select PPC_64S_HASH_MMU
 
 config GENERIC_CPU
 	bool "Generic (POWER8 and above)"
-	depends on PPC64 && CPU_LITTLE_ENDIAN
+	depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
 	select ARCH_HAS_FAST_MULTIPLIER
 	select PPC_64S_HASH_MMU
 
@@ -358,7 +358,7 @@  config PHYS_64BIT
 
 config ALTIVEC
 	bool "AltiVec Support"
-	depends on PPC_BOOK3S_32 || PPC_BOOK3S_64 || (PPC_E500MC && PPC64)
+	depends on PPC_BOOK3S || (PPC_E500MC && PPC64 && !E5500_CPU)
 	select PPC_FPU
 	help
 	  This option enables kernel support for the Altivec extensions to the