[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#823526: linux: FTBFS on powerpcspe due to the use of unsupported instructions



On Thu, May 05, 2016 at 06:59:33PM +0200, John Paul Adrian Glaubitz wrote:
> Source: linux
> Version: 4.5.2-1
> Severity: normal
> User: debian-powerpc@lists.debian.org
> Usertags: powerpcspe
> 
> Hi!
> 
> linux currently fails to build from source on powerpcspe since the compiler
> is using FPU instructions which are not available on the e500v2 CPUs [1,2]:
> 
> {standard input}: Assembler messages:
> {standard input}:2227: Error: unrecognized opcode: `ldarx'
> {standard input}:2274: Error: unrecognized opcode: `stdcx.'
> /<<PKGBUILDDIR>>/scripts/Makefile.build:263: recipe for target 'arch/powerpc/lib/sstep.o' failed
> make[6]: *** [arch/powerpc/lib/sstep.o] Error 1
> /<<PKGBUILDDIR>>/Makefile:954: recipe for target 'arch/powerpc/lib' failed
> make[5]: *** [arch/powerpc/lib] Error 2
> make[5]: *** Waiting for unfinished jobs....
> 
> Looking at arch/powerpc/lib/sstep.c, there are actually #ifdefs for the CONFIG_PPC_FPU,
> however, it seems there is no way of manually setting CONFIG_PPC_FPU in the kernel
> configuration. I assume, this is done by choosing a certain type of PowerPC hardware.
> 
> In any case, version 3.16.7 still builds fine [3], so this is a regression either
> way. Although we currently have to use a custom kernel for our e500v2 boards
> anyway, it's still desirable to fix any build issues with the kernel package
> on powerpcspe.

I think this would fix it:

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index dc885b3..6d34310 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1818,9 +1818,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
 		case 4:
 			__get_user_asmx(val, op.ea, err, "lwarx");
 			break;
+#ifdef __powerpc64__
 		case 8:
 			__get_user_asmx(val, op.ea, err, "ldarx");
 			break;
+#endif
 		default:
 			return 0;
 		}
@@ -1841,9 +1843,11 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
 		case 4:
 			__put_user_asmx(op.val, op.ea, err, "stwcx.", cr);
 			break;
+#ifdef __powerpc64__
 		case 8:
 			__put_user_asmx(op.val, op.ea, err, "stdcx.", cr);
 			break;
+#endif
 		default:
 			return 0;
 		}

It seems that gas on powerpc is willing to accept ldarx and stdcx even
when compiling in 32 bit mode (even though the instructions are not
allowed in 32 bit mode), while gas for powerpcspe does not seem willing
to accept them.  So they need to be left out when building on 32 bit
systems, just like everywhere else in that file already did.

If it works, I can submit it to the kernel.  I don't have a powerpcspe
environment to try building it, but I did notice that sstep.o contained
those two instructions when building a ppc32 kernel, and that's wrong.
After the patch those are gone as expected.

-- 
Len Sorensen


Reply to: