[gcc(refs/users/wschmidt/heads/dd2)] rs6000: ROP cleanups

William Schmidt wschmidt@gcc.gnu.org
Thu Mar 25 20:03:33 GMT 2021


https://gcc.gnu.org/g:dcb3d875cb58647dde9aa258169169da67a97c64

commit dcb3d875cb58647dde9aa258169169da67a97c64
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Thu Mar 25 14:51:40 2021 -0500

    rs6000: ROP cleanups
    
    2021-03-25  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000-logue.c (rs6000_emit_prologue): Add NOTE
            about sibcalls.
            * config/rs6000/rs6000.md (hashst): Use
            simple_offsettable_mem_operand.
            (hashstp): Likewise.
            (hashchk): Likewise.
            (hashchkp): Likewise.

Diff:
---
 gcc/config/rs6000/rs6000-logue.c | 3 +++
 gcc/config/rs6000/rs6000.md      | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-logue.c b/gcc/config/rs6000/rs6000-logue.c
index ebfcf3300c1..5e91672bea5 100644
--- a/gcc/config/rs6000/rs6000-logue.c
+++ b/gcc/config/rs6000/rs6000-logue.c
@@ -3279,6 +3279,9 @@ rs6000_emit_prologue (void)
     }
 
   /* The ROP hash store must occur before a stack frame is created.  */
+  /* NOTE: The hashst isn't needed if we're going to do a sibcall,
+     but there's no way to know that here.  Harmless except for
+     performance, of course.  */
   if (TARGET_POWER10 && rs6000_rop_protect && info->rop_check_size != 0)
     {
       gcc_assert (DEFAULT_ABI == ABI_ELFv2);
diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index d109640b681..05336c5bf71 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -14950,7 +14950,7 @@
 ;; ROP mitigation instructions.
 
 (define_insn "hashst"
-  [(set (match_operand:DI 0 "memory_operand" "=m")
+  [(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"
@@ -14958,7 +14958,7 @@
   [(set_attr "type" "store")])
 
 (define_insn "hashstp"
-  [(set (match_operand:DI 0 "memory_operand" "=m")
+  [(set (match_operand:DI 0 "simple_offsettable_mem_operand" "=m")
         (unspec:DI [(match_operand:DI 1 "int_reg_operand" "r")]
 	           UNSPEC_HASHSTP))]
   "TARGET_POWER10 && rs6000_rop_protect && rs6000_privileged"
@@ -14967,7 +14967,7 @@
 
 (define_insn "hashchk"
   [(unspec_volatile [(match_operand:DI 0 "int_reg_operand" "r")
-		     (match_operand:DI 1 "memory_operand" "m")]
+		     (match_operand:DI 1 "simple_offsettable_mem_operand" "m")]
 		    UNSPEC_HASHCHK)]
   "TARGET_POWER10 && rs6000_rop_protect"
   "hashchk %0,%1"
@@ -14975,7 +14975,7 @@
 
 (define_insn "hashchkp"
   [(unspec_volatile [(match_operand:DI 0 "int_reg_operand" "r")
-		     (match_operand:DI 1 "memory_operand" "m")]
+		     (match_operand:DI 1 "simple_offsettable_mem_operand" "m")]
 		    UNSPEC_HASHCHKP)]
   "TARGET_POWER10 && rs6000_rop_protect && rs6000_privileged"
   "hashchkp %0,%1"


More information about the Gcc-cvs mailing list