From 47e16c6a6aed01dde2774a5490a3e5c7f97e9f92 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Thu, 3 Dec 2015 14:17:35 +0000 Subject: [PATCH] Fix some issues with the ROP patch (PR 68471, 68472) 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. From-SVN: r231228 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/i386/i386.c | 3 ++- gcc/config/i386/i386.md | 1 + gcc/regrename.c | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f5017efa1a..6e9c823d3aa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2015-12-03 Bernd Schmidt + + 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 * config/nvptx/nvptx-protos.h (npvptx_section_from_addr_space): Delete. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 05e7fe6d39a..96d6c98d935 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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); diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index e8c5f061331..f2b20412137 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -12421,6 +12421,7 @@ "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" diff --git a/gcc/regrename.c b/gcc/regrename.c index e2a1e83c7ea..701e0789955 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4dd7f3d2190..9cbd390a803 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-03 Bernd Schmidt + + PR target/68472 + * gcc.target/i386/rop1.c: New test. + 2015-12-03 Nathan Sidwell * gcc.target/nvptx/decl.c: New. -- 2.30.2