* [PATCH] rs6000: testsuite: Add rop_ok effective-target function
@ 2021-11-11 22:12 Peter Bergner
2021-12-02 23:15 ` Segher Boessenkool
0 siblings, 1 reply; 3+ messages in thread
From: Peter Bergner @ 2021-11-11 22:12 UTC (permalink / raw)
To: Segher Boessenkool, David Edelsohn; +Cc: GCC Patches, Bill Schmidt
This patch adds a new effective-target function that tests whether
it is safe to emit the ROP-protect instructions and updates the
ROP test cases to use it.
Segher, as we discussed offline, this uses the double [] which you said
isn't needed in general regex's, but for some reason is needed in the gcc
testsuite regex.
Tested on powerpc64le*-linux with no regressions. Ok for mainline?
Peter
gcc/testsuite/
* lib/target-supports.exp (check_effective_target_rop_ok): New function.
* gcc.target/powerpc/rop-1.c: Use it.
* gcc.target/powerpc/rop-2.c: Likewise.
* gcc.target/powerpc/rop-3.c: Likewise.
* gcc.target/powerpc/rop-4.c: Likewise.
* gcc.target/powerpc/rop-5.c: Likewise.
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 1c8b1ebb86e..0d9a3ba67ce 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -6625,6 +6625,13 @@ proc check_effective_target_powerpc_elfv2 { } {
}
}
+# Return 1 if this is a PowerPC target supporting -mrop-protect
+
+proc check_effective_target_rop_ok { } {
+ return [check_effective_target_power10_ok]
+ && [check_effective_target_powerpc_elfv2]
+}
+
# The VxWorks SPARC simulator accepts only EM_SPARC executables and
# chokes on EM_SPARC32PLUS or EM_SPARCV9 executables. Return 1 if the
# test environment appears to run executables on such a simulator.
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-1.c b/gcc/testsuite/gcc.target/powerpc/rop-1.c
index 8cedcb6668a..12893dec027 100644
--- a/gcc/testsuite/gcc.target/powerpc/rop-1.c
+++ b/gcc/testsuite/gcc.target/powerpc/rop-1.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
-/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-require-effective-target rop_ok } */
/* Verify that ROP-protect instructions are inserted when a
call is present. */
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-2.c b/gcc/testsuite/gcc.target/powerpc/rop-2.c
index c556952aec1..5f1d7c39bfc 100644
--- a/gcc/testsuite/gcc.target/powerpc/rop-2.c
+++ b/gcc/testsuite/gcc.target/powerpc/rop-2.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect -mprivileged" } */
-/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-require-effective-target rop_ok } */
/* Verify that privileged ROP-protect instructions are inserted when a
call is present. */
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-3.c b/gcc/testsuite/gcc.target/powerpc/rop-3.c
index 8d03792e3e5..d2ef3bf4bad 100644
--- a/gcc/testsuite/gcc.target/powerpc/rop-3.c
+++ b/gcc/testsuite/gcc.target/powerpc/rop-3.c
@@ -1,5 +1,5 @@
/* { dg-do run { target { power10_hw } } } */
-/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-require-effective-target rop_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
/* Verify that ROP-protect instructions execute correctly when a
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-4.c b/gcc/testsuite/gcc.target/powerpc/rop-4.c
index dcf47c63fb7..80faa9b3f7b 100644
--- a/gcc/testsuite/gcc.target/powerpc/rop-4.c
+++ b/gcc/testsuite/gcc.target/powerpc/rop-4.c
@@ -1,6 +1,6 @@
/* { dg-do compile } */
/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
-/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-require-effective-target rop_ok } */
/* Verify that no ROP-protect instructions are inserted when no
call is present. */
diff --git a/gcc/testsuite/gcc.target/powerpc/rop-5.c b/gcc/testsuite/gcc.target/powerpc/rop-5.c
index f2594df8a44..f7970f1fe25 100644
--- a/gcc/testsuite/gcc.target/powerpc/rop-5.c
+++ b/gcc/testsuite/gcc.target/powerpc/rop-5.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-require-effective-target powerpc_elfv2 } */
+/* { dg-require-effective-target rop_ok } */
/* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
/* Verify that __ROP_PROTECT__ is predefined for -mrop-protect. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rs6000: testsuite: Add rop_ok effective-target function
2021-11-11 22:12 [PATCH] rs6000: testsuite: Add rop_ok effective-target function Peter Bergner
@ 2021-12-02 23:15 ` Segher Boessenkool
2021-12-03 20:35 ` Peter Bergner
0 siblings, 1 reply; 3+ messages in thread
From: Segher Boessenkool @ 2021-12-02 23:15 UTC (permalink / raw)
To: Peter Bergner; +Cc: David Edelsohn, GCC Patches, Bill Schmidt
Hi!
On Thu, Nov 11, 2021 at 04:12:08PM -0600, Peter Bergner wrote:
> This patch adds a new effective-target function that tests whether
> it is safe to emit the ROP-protect instructions and updates the
> ROP test cases to use it.
>
> Segher, as we discussed offline, this uses the double [] which you said
> isn't needed in general regex's, but for some reason is needed in the gcc
> testsuite regex.
> +proc check_effective_target_rop_ok { } {
> + return [check_effective_target_power10_ok]
> + && [check_effective_target_powerpc_elfv2]
> +}
That's not a regular expression ;-)
It is easiest to put [] around each function call, it will take && as
argument if you write is as [checkA && checkB] . I'm not sure what I
meant, sorry :-) Writing it as you did is simpler and more idiomatic
than other ways of achieving this.
> Tested on powerpc64le*-linux with no regressions. Ok for mainline?
What can "*" be there other than the empty string? Which valuse of "*"
did you test? :-)
> gcc/testsuite/
> * lib/target-supports.exp (check_effective_target_rop_ok): New function.
> * gcc.target/powerpc/rop-1.c: Use it.
> * gcc.target/powerpc/rop-2.c: Likewise.
> * gcc.target/powerpc/rop-3.c: Likewise.
> * gcc.target/powerpc/rop-4.c: Likewise.
> * gcc.target/powerpc/rop-5.c: Likewise.
> --- a/gcc/testsuite/gcc.target/powerpc/rop-3.c
> +++ b/gcc/testsuite/gcc.target/powerpc/rop-3.c
> @@ -1,5 +1,5 @@
> /* { dg-do run { target { power10_hw } } } */
> -/* { dg-require-effective-target powerpc_elfv2 } */
> +/* { dg-require-effective-target rop_ok } */
> /* { dg-options "-O2 -mdejagnu-cpu=power10 -mrop-protect" } */
Okay for trunk. Thanks!
Segher
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rs6000: testsuite: Add rop_ok effective-target function
2021-12-02 23:15 ` Segher Boessenkool
@ 2021-12-03 20:35 ` Peter Bergner
0 siblings, 0 replies; 3+ messages in thread
From: Peter Bergner @ 2021-12-03 20:35 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: David Edelsohn, GCC Patches, Bill Schmidt
On 12/2/21 5:15 PM, Segher Boessenkool wrote:
>> Tested on powerpc64le*-linux with no regressions. Ok for mainline?
>
> What can "*" be there other than the empty string? Which valuse of "*"
> did you test? :-)
Heh, too used to typing powerpc64*-linux. Yeah, in this case * == "".
> Okay for trunk. Thanks!
Thanks, pushed.
Peter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-03 20:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 22:12 [PATCH] rs6000: testsuite: Add rop_ok effective-target function Peter Bergner
2021-12-02 23:15 ` Segher Boessenkool
2021-12-03 20:35 ` Peter Bergner
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 read-only IMAP folder(s) and NNTP newsgroup(s).