public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/67215] -fno-plt needs improvements for x86
Date: Tue, 27 Oct 2015 14:30:00 -0000	[thread overview]
Message-ID: <bug-67215-4-XGcR17K3Vp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-67215-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Tue Oct 27 14:29:31 2015
New Revision: 229444

URL: https://gcc.gnu.org/viewcvs?rev=229444&root=gcc&view=rev
Log:
Properly handle -fno-plt in ix86_expand_call

prepare_call_address in calls.c is the wrong place to handle -fno-plt.
We shoudn't force function address into register and hope that load
function address via GOT and indirect call via register will be folded
into indirect call via GOT, which doesn't always happen.  Also non-PIC
case can only be handled in backend.  Instead, backend should expand
external function call into indirect call via GOT for -fno-plt.

This patch reverts -fno-plt in prepare_call_address and handles it in
ix86_expand_call.  Other backends may need similar changes to support
-fno-plt.  Alternately, we can introduce a target hook to indicate
whether an external function should be called via register for -fno-plt
so that i386 backend can disable it in prepare_call_address.

gcc/

        PR target/67215
        * calls.c (prepare_call_address): Don't handle -fno-plt here.
        * config/i386/i386.c (ix86_expand_call): Generate indirect call
        via GOT for -fno-plt.  Support indirect call via GOT for x32.
        * config/i386/predicates.md (sibcall_memory_operand): Allow
        GOT memory operand.

gcc/testsuite/

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

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr67215-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr67215-2.c
    trunk/gcc/testsuite/gcc.target/i386/pr67215-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/calls.c
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/predicates.md
    trunk/gcc/testsuite/ChangeLog


      parent reply	other threads:[~2015-10-27 14:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 12:37 [Bug target/67215] New: " andrew.n.senkevich at gmail dot com
2015-08-14 12:45 ` [Bug target/67215] " hjl.tools at gmail dot com
2015-08-14 13:00 ` andrew.n.senkevich at gmail dot com
2015-08-14 13:07 ` hjl.tools at gmail dot com
2015-08-14 15:25 ` andrew.n.senkevich at gmail dot com
2015-08-14 15:34 ` hjl.tools at gmail dot com
2015-08-16  1:08 ` hjl.tools at gmail dot com
2015-09-06 10:59 ` LpSolit at netscape dot net
2015-10-27 14:30 ` hjl.tools at gmail dot com
2015-10-27 14:30 ` hjl at gcc dot gnu.org [this message]

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-67215-4-XGcR17K3Vp@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).