On Wed, Apr 18, 2018 at 7:00 AM, Tsimbalist, Igor V <[email protected]> wrote: >> -----Original Message----- >> From: [email protected] [mailto:gcc-patches- >> [email protected]] On Behalf Of H.J. Lu >> Sent: Wednesday, April 18, 2018 3:25 PM >> To: GCC Patches <[email protected]>; Tsimbalist, Igor V >> <[email protected]> >> Cc: Uros Bizjak <[email protected]> >> Subject: PING: [PATCH] i386: Insert ENDBR after __morestack call >> >> On Fri, Apr 13, 2018 at 5:56 AM, H.J. Lu <[email protected]> wrote: >> > Since __morestack will jump back to its callee via indirect call, we >> > need to insert ENDBR after calling __morestack. >> > >> > OK for trunk? >> > >> > H.J. >> > ---- >> > gcc/ >> > >> > PR target/85388 >> > * config/i386/i386.c (ix86_expand_split_stack_prologue): Insert >> > ENDBR after calling __morestack. >> > >> > gcc/testsuite/ >> > >> > PR target/85388 >> > * gcc.dg/pr85388-1.c: New test. >> > * gcc.dg/pr85388-2.c: Likewise. >> > * gcc.dg/pr85388-3.c: Likewise. >> > * gcc.dg/pr85388-4.c: Likewise. >> > * gcc.dg/pr85388-5.c: Likewise. >> > * gcc.dg/pr85388-6.c: Likewise. >> > --- >> > gcc/config/i386/i386.c | 11 ++++++- >> > gcc/testsuite/gcc.dg/pr85388-1.c | 50 >> +++++++++++++++++++++++++++++ >> > gcc/testsuite/gcc.dg/pr85388-2.c | 56 >> ++++++++++++++++++++++++++++++++ >> > gcc/testsuite/gcc.dg/pr85388-3.c | 65 >> +++++++++++++++++++++++++++++++++++++ >> > gcc/testsuite/gcc.dg/pr85388-4.c | 69 >> ++++++++++++++++++++++++++++++++++++++++ >> > gcc/testsuite/gcc.dg/pr85388-5.c | 54 >> +++++++++++++++++++++++++++++++ >> > gcc/testsuite/gcc.dg/pr85388-6.c | 56 >> ++++++++++++++++++++++++++++++++ >> > 7 files changed, 360 insertions(+), 1 deletion(-) >> > create mode 100644 gcc/testsuite/gcc.dg/pr85388-1.c >> > create mode 100644 gcc/testsuite/gcc.dg/pr85388-2.c >> > create mode 100644 gcc/testsuite/gcc.dg/pr85388-3.c >> > create mode 100644 gcc/testsuite/gcc.dg/pr85388-4.c >> > create mode 100644 gcc/testsuite/gcc.dg/pr85388-5.c >> > create mode 100644 gcc/testsuite/gcc.dg/pr85388-6.c >> > >> > diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c >> > index 03e5c433574..8b4fd8ae30b 100644 >> > --- a/gcc/config/i386/i386.c >> > +++ b/gcc/config/i386/i386.c >> > @@ -15242,7 +15242,16 @@ ix86_expand_split_stack_prologue (void) >> > instruction--we need control flow to continue at the subsequent >> > label. Therefore, we use an unspec. */ >> > gcc_assert (crtl->args.pops_args < 65536); >> > - emit_insn (gen_split_stack_return (GEN_INT (crtl->args.pops_args))); >> > + rtx_insn *ret_insn >> > + = emit_insn (gen_split_stack_return (GEN_INT (crtl->args.pops_args))); >> > + >> > + if ((flag_cf_protection & CF_BRANCH) && TARGET_IBT) >> > + { >> > + /* Insert ENDBR since __morestack will jump back here via indirect >> > + call. */ >> > + rtx cet_eb = gen_nop_endbr (); >> > + emit_insn_after (cet_eb, ret_insn); >> > + } >> > >> > /* If we are in 64-bit mode and this function uses a static chain, >> > we saved %r10 in %rax before calling _morestack. */ >> >> PING: >> >> https://gcc.gnu.org/ml/gcc-patches/2018-04/msg00669.html >> > > OK.
I am going to check it in. Thanks. -- H.J.
