Build failures in powerpc ptrace selftests

Seth Forshee seth.forshee at canonical.com
Thu Aug 31 22:27:59 AEST 2017


On Thu, Aug 31, 2017 at 01:41:47AM +0800, Simon Guo wrote:
> Hi Seth,
> On Wed, Aug 30, 2017 at 08:05:25AM -0500, Seth Forshee wrote:
> > With gcc 7 from Ubuntu 17.10 I'm getting the follwing error building the
> > ptrace selftests for powerpc:
> > 
> >   ptrace-tm-vsx.c: In function ‘tm_vsx’:
> >   ptrace-tm-vsx.c:42:2: error: PIC register clobbered by ‘r2’ in ‘asm’
> >     asm __volatile__(
> >     ^~~
> >   make[1]: *** [ptrace-tm-vsx] Error 1
> >   ptrace-tm-spd-vsx.c: In function ‘tm_spd_vsx’:
> >   ptrace-tm-spd-vsx.c:55:2: error: PIC register clobbered by ‘r2’ in ‘asm’
> >     asm __volatile__(
> >     ^~~
> >   make[1]: *** [ptrace-tm-spd-vsx] Error 1
> >   ptrace-tm-spr.c: In function ‘tm_spr’:
> >   ptrace-tm-spr.c:46:2: error: PIC register clobbered by ‘r2’ in ‘asm’
> >     asm __volatile__(
> >     ^~~
> > 
> > Best I can tell gcc now considers any inline asm which clobbers r2 an
> > error, and I get it even with -fno-pic. I'm not familiar with powerpc
> > asm, but it's not obvious to me why r2 is in the clobber list for any of
> > these.
> Thanks for reporting this issue.
> 
> In PPC ABI, r2 is used as TOC pointer and it might be changed by inter-module 
> function calls. I believe that is the reason why it was put into clobber list 
> originally.
> 
> In our case, dual entry is used to save TOC pointer (r2) update for function
> calls within one module. There is no r2 change and I think r2 can be moved out 
> of clobber list.
> 
> I don't have a GCC-7 environment. If possible, could you help to try following 
> patch?

Your patch fixes the build errors for me. Thanks!

Seth


More information about the Linuxppc-dev mailing list