public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/94417] -fcf-protection -mcmodel=large/-mforce-indirect-call is broken
Date: Wed, 08 Apr 2020 16:48:36 +0000	[thread overview]
Message-ID: <bug-94417-4-F8hNZ5E1Ro@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94417-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94417

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by H.J. Lu <hjl@gcc.gnu.org>:

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

commit r10-7633-gc5f379653964a1d2c7037b2de3e947a48370a198
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Apr 8 09:47:35 2020 -0700

    x86: Insert ENDBR if function will be called indirectly

    Since constant_call_address_operand has

    ;; Test for a pc-relative call operand
    (define_predicate "constant_call_address_operand"
      (match_code "symbol_ref")
    {
      if (ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC
          || flag_force_indirect_call)
        return false;
      if (TARGET_DLLIMPORT_DECL_ATTRIBUTES && SYMBOL_REF_DLLIMPORT_P (op))
        return false;
      return true;
    })

    even if cgraph_node::get (cfun->decl)->only_called_directly_p () returns
    false, the fuction may still be called indirectly.  Copy the logic from
    constant_call_address_operand to rest_of_insert_endbranch to insert ENDBR
    at function entry if function will be called indirectly.

    gcc/

            PR target/94417
            * config/i386/i386-features.c (rest_of_insert_endbranch): Insert
            ENDBR at function entry if function will be called indirectly.

    gcc/testsuite/

            PR target/94417
            * gcc.target/i386/pr94417-1.c: New test.
            * gcc.target/i386/pr94417-2.c: Likewise.
            * gcc.target/i386/pr94417-3.c: Likewise.

  parent reply	other threads:[~2020-04-08 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 23:37 [Bug target/94417] New: -fcf-protection -mcmodel=large " hjl.tools at gmail dot com
2020-03-31  5:30 ` [Bug target/94417] -fcf-protection -mcmodel=large/-mforce-indirect-call " hjl.tools at gmail dot com
2020-03-31  5:36 ` hjl.tools at gmail dot com
2020-03-31 15:12 ` hjl.tools at gmail dot com
2020-04-08 16:48 ` cvs-commit at gcc dot gnu.org [this message]
2020-04-08 16:52 ` hjl.tools at gmail dot com
2020-04-17 22:24 ` cvs-commit at gcc dot gnu.org
2020-04-17 22:33 ` cvs-commit at gcc dot gnu.org
2020-04-17 22:34 ` hjl.tools at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94417-4-F8hNZ5E1Ro@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).