Fix some issues with the ROP patch (PR 68471, 68472)
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Dec 2015 14:17:35 +0000 (14:17 +0000)
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Dec 2015 14:17:35 +0000 (14:17 +0000)
PR target/68471
PR target/68472
* config/i386/i386.c (ix86_mitigate_rop): Don't call
compute_bb_for_insn again.  Call df_insn_rescan_all.
* config/i386/i386.md (set_got_rex64): Override modrm_class.

* regrename.c (build_def_use): Ignore stack regs if regstack_completed.

testsuite/
* gcc.target/i386/rop1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231228 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md
gcc/regrename.c
gcc/testsuite/ChangeLog

index 8f5017e..6e9c823 100644 (file)
@@ -1,3 +1,13 @@
+2015-12-03  Bernd Schmidt  <bschmidt@redhat.com>
+
+       PR target/68471
+       PR target/68472
+       * config/i386/i386.c (ix86_mitigate_rop): Don't call
+       compute_bb_for_insn again.  Call df_insn_rescan_all.
+       * config/i386/i386.md (set_got_rex64): Override modrm_class.
+
+       * regrename.c (build_def_use): Ignore stack regs if regstack_completed.
+
 2015-12-03  Nathan Sidwell  <nathan@acm.org>
 
        * config/nvptx/nvptx-protos.h (npvptx_section_from_addr_space): Delete.
index 05e7fe6..96d6c98 100644 (file)
@@ -45267,8 +45267,9 @@ ix86_mitigate_rop (void)
   COPY_HARD_REG_SET (inout_risky, input_risky);
   IOR_HARD_REG_SET (inout_risky, output_risky);
 
-  compute_bb_for_insn ();
   df_note_add_problem ();
+  /* Fix up what stack-regs did.  */
+  df_insn_rescan_all ();
   df_analyze ();
 
   regrename_init (true);
index e8c5f06..f2b2041 100644 (file)
   "lea{q}\t{_GLOBAL_OFFSET_TABLE_(%%rip), %0|%0, _GLOBAL_OFFSET_TABLE_[rip]}"
   [(set_attr "type" "lea")
    (set_attr "length_address" "4")
+   (set_attr "modrm_class" "unknown")
    (set_attr "mode" "DI")])
 
 (define_insn "set_rip_rex64"
index e2a1e83..701e078 100644 (file)
@@ -1677,6 +1677,12 @@ build_def_use (basic_block bb)
                      untracked_operands |= 1 << matches;
                    }
                }
+#ifdef STACK_REGS
+             if (regstack_completed
+                 && REG_P (op)
+                 && IN_RANGE (REGNO (op), FIRST_STACK_REG, LAST_STACK_REG))
+               untracked_operands |= 1 << i;
+#endif
              /* If there's an in-out operand with a register that is not
                 being tracked at all yet, open a chain.  */
              if (recog_data.operand_type[i] == OP_INOUT
index 4dd7f3d..9cbd390 100644 (file)
@@ -1,3 +1,8 @@
+2015-12-03  Bernd Schmidt  <bschmidt@redhat.com>
+
+       PR target/68472
+       * gcc.target/i386/rop1.c: New test.
+
 2015-12-03  Nathan Sidwell  <nathan@acm.org>
 
        * gcc.target/nvptx/decl.c: New.