linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/powerpc: fix build error in powerpc ptrace selftests.
@ 2017-09-01  2:17 wei.guo.simon
  2017-10-10 10:10 ` Michael Ellerman
  2017-12-12 11:39 ` Michael Ellerman
  0 siblings, 2 replies; 4+ messages in thread
From: wei.guo.simon @ 2017-09-01  2:17 UTC (permalink / raw)
  To: Anshuman Khandual; +Cc: linuxppc-dev, Michael Ellerman, Simon Guo

From: Simon Guo <wei.guo.simon@gmail.com>

GCC 7 will take "r2" in clobber list as an error will it will get following
build errors for powerpc ptrace selftests even with -fno-pic option:
  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__(
    ^~~

This patch fix the build error by removing "r2" out of clobber list.

Reported-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
Tested-by: Seth Forshee <seth.forshee@canonical.com>
---
 tools/testing/selftests/powerpc/ptrace/Makefile            | 2 +-
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c | 4 ++--
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c     | 3 +--
 tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c     | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile
index fe6bc60..c836f6d 100644
--- a/tools/testing/selftests/powerpc/ptrace/Makefile
+++ b/tools/testing/selftests/powerpc/ptrace/Makefile
@@ -6,7 +6,7 @@ include ../../lib.mk
 
 all: $(TEST_PROGS)
 
-CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm
+CFLAGS += -m64 -I../../../../../usr/include -I../tm -mhtm -fno-pic
 
 $(TEST_PROGS): ../harness.c ../utils.c ../lib/reg.S ptrace.h
 
diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c
index 0df3c23..277dade 100644
--- a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c
+++ b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c
@@ -79,8 +79,8 @@ void tm_spd_vsx(void)
 		: [res] "=r" (result), [texasr] "=r" (texasr)
 		: [fp_load] "r" (fp_load), [fp_load_ckpt] "r" (fp_load_ckpt),
 		[sprn_texasr] "i"  (SPRN_TEXASR)
-		: "memory", "r0", "r1", "r2", "r3", "r4",
-		"r8", "r9", "r10", "r11"
+		: "memory", "r0", "r1", "r3", "r4",
+		"r7", "r8", "r9", "r10", "r11"
 		);
 
 	if (result) {
diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c
index 94e57cb..51427a2 100644
--- a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c
+++ b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c
@@ -76,8 +76,7 @@ void tm_spr(void)
 		: [tfhar] "=r" (tfhar), [res] "=r" (result),
 		[texasr] "=r" (texasr), [cptr1] "=r" (cptr1)
 		: [sprn_texasr] "i"  (SPRN_TEXASR)
-		: "memory", "r0", "r1", "r2", "r3", "r4",
-		"r8", "r9", "r10", "r11", "r31"
+		: "memory", "r0", "r8", "r31"
 		);
 
 	/* There are 2 32bit instructions before tbegin. */
diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c
index b4081e2..17c23ca 100644
--- a/tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c
+++ b/tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c
@@ -67,7 +67,7 @@ void tm_vsx(void)
 		: [res] "=r" (result), [texasr] "=r" (texasr)
 		: [fp_load] "r" (fp_load), [fp_load_ckpt] "r" (fp_load_ckpt),
 		[sprn_texasr] "i"  (SPRN_TEXASR), [cptr1] "r" (&cptr[1])
-		: "memory", "r0", "r1", "r2", "r3", "r4",
+		: "memory", "r0", "r1", "r3", "r4",
 		"r7", "r8", "r9", "r10", "r11"
 		);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/powerpc: fix build error in powerpc ptrace selftests.
  2017-10-10 10:10 ` Michael Ellerman
@ 2017-10-09 20:18   ` Simon Guo
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Guo @ 2017-10-09 20:18 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: Anshuman Khandual, linuxppc-dev

Hi Michael,
On Tue, Oct 10, 2017 at 09:10:32PM +1100, Michael Ellerman wrote:
> wei.guo.simon@gmail.com writes:
> 
> > From: Simon Guo <wei.guo.simon@gmail.com>
> >
> > GCC 7 will take "r2" in clobber list as an error will it will get following
> > build errors for powerpc ptrace selftests even with -fno-pic option:
> >   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__(
> >     ^~~
> >
> > This patch fix the build error by removing "r2" out of clobber list.
> 
> But do any of the blocks clobber r2? If so then it should be in the
> clobber list.

I see none of them clobbers r2, and neither does those assembly
functions which those blocks calls, like "loadvsx".

For the change on tools/testing/selftests/powerpc/ptrace/Makefile, it
can be ignored since I noticed recent commit a3c01050584da3 "selftests/powerpc: 
Force ptrace tests to build -fno-pie". Please let me know if you want
a new v2 to remove that change on ptrace/Makefile.

Thanks,
- Simon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] selftests/powerpc: fix build error in powerpc ptrace selftests.
  2017-09-01  2:17 [PATCH] selftests/powerpc: fix build error in powerpc ptrace selftests wei.guo.simon
@ 2017-10-10 10:10 ` Michael Ellerman
  2017-10-09 20:18   ` Simon Guo
  2017-12-12 11:39 ` Michael Ellerman
  1 sibling, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2017-10-10 10:10 UTC (permalink / raw)
  To: wei.guo.simon, Anshuman Khandual; +Cc: linuxppc-dev, Simon Guo

wei.guo.simon@gmail.com writes:

> From: Simon Guo <wei.guo.simon@gmail.com>
>
> GCC 7 will take "r2" in clobber list as an error will it will get followi=
ng
> build errors for powerpc ptrace selftests even with -fno-pic option:
>   ptrace-tm-vsx.c: In function =E2=80=98tm_vsx=E2=80=99:
>   ptrace-tm-vsx.c:42:2: error: PIC register clobbered by =E2=80=98r2=E2=
=80=99 in =E2=80=98asm=E2=80=99
>     asm __volatile__(
>     ^~~
>   make[1]: *** [ptrace-tm-vsx] Error 1
>   ptrace-tm-spd-vsx.c: In function =E2=80=98tm_spd_vsx=E2=80=99:
>   ptrace-tm-spd-vsx.c:55:2: error: PIC register clobbered by =E2=80=98r2=
=E2=80=99 in =E2=80=98asm=E2=80=99
>     asm __volatile__(
>     ^~~
>   make[1]: *** [ptrace-tm-spd-vsx] Error 1
>   ptrace-tm-spr.c: In function =E2=80=98tm_spr=E2=80=99:
>   ptrace-tm-spr.c:46:2: error: PIC register clobbered by =E2=80=98r2=E2=
=80=99 in =E2=80=98asm=E2=80=99
>     asm __volatile__(
>     ^~~
>
> This patch fix the build error by removing "r2" out of clobber list.

But do any of the blocks clobber r2? If so then it should be in the
clobber list.

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: selftests/powerpc: fix build error in powerpc ptrace selftests.
  2017-09-01  2:17 [PATCH] selftests/powerpc: fix build error in powerpc ptrace selftests wei.guo.simon
  2017-10-10 10:10 ` Michael Ellerman
@ 2017-12-12 11:39 ` Michael Ellerman
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-12-12 11:39 UTC (permalink / raw)
  To: wei.guo.simon, Anshuman Khandual; +Cc: linuxppc-dev, Simon Guo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]

On Fri, 2017-09-01 at 02:17:14 UTC, wei.guo.simon@gmail.com wrote:
> From: Simon Guo <wei.guo.simon@gmail.com>
> 
> GCC 7 will take "r2" in clobber list as an error will it will get following
> build errors for powerpc ptrace selftests even with -fno-pic option:
>   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__(
>     ^~~
> 
> This patch fix the build error by removing "r2" out of clobber list.
> 
> Reported-by: Seth Forshee <seth.forshee@canonical.com>
> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
> Tested-by: Seth Forshee <seth.forshee@canonical.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f36dbfe1a504b85c7b3bf89fdd9999

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-12 11:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-01  2:17 [PATCH] selftests/powerpc: fix build error in powerpc ptrace selftests wei.guo.simon
2017-10-10 10:10 ` Michael Ellerman
2017-10-09 20:18   ` Simon Guo
2017-12-12 11:39 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).