Re: [PATCH 2/4] rs6000: Emit ROP-mitigation instructions in prologue and epilogue

2021-05-14 Thread Bill Schmidt via Gcc-patches

On 5/14/21 1:44 PM, Segher Boessenkool wrote:
Please make this an unspec_volatile? 


Oops!  Sorry for missing that the first time.

Thanks for the review!!

Bill



Re: [PATCH 2/4] rs6000: Emit ROP-mitigation instructions in prologue and epilogue

2021-05-14 Thread Segher Boessenkool
Hi!

On Thu, May 13, 2021 at 10:34:55PM -0500, Bill Schmidt via Gcc-patches wrote:
> +;; ROP mitigation instructions.
> +
> +(define_insn "hashst"
> +  [(set (match_operand:DI 0 "simple_offsettable_mem_operand" "=m")
> +(unspec:DI [(match_operand:DI 1 "int_reg_operand" "r")]
> +UNSPEC_HASHST))]
> +  "TARGET_POWER10 && rs6000_rop_protect"
> +{
> +  static char templ[14];

14 is okay, but why not use 200 or so?  You don't call anything anyway
(except that sprintf itself perhaps).  Or 50 or whatever.  Something so
ridiculously big that you do not have to count, that's my point :-)

> +  char p[2];
> +
> +  if (rs6000_privileged)
> +{
> +  p[0] = 'p';
> +  p[1] = 0;
> +}
> +  else
> +p[0] = 0;

const char *p = rs6000_privileged ? "p" : "";

Please make this an unspec_volatile?

> +(define_insn "hashchk"

Same things here of course, but it is volatile already.

Okay for trunk and 11 with such changes.  Thanks!


Segher