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