This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt=
- From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- To: Sriraman Tallam <tmsriram at google dot com>,ramrad01 at arm dot com
- Cc: Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>,Jan Hubicka <hubicka at ucw dot cz>,"H.J. Lu" <hjl dot tools at gmail dot com>,Pedro Alves <palves at redhat dot com>,Michael Matz <matz at suse dot de>,David Li <davidxl at google dot com>,GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 02 Jun 2015 21:32:05 +0200
- Subject: Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt=
- Authentication-results: sourceware.org; auth=none
- References: <CAMe9rOrCh++A=jLOcDVXGM+UOyn31kuJ+R5ZmZkw8E_eHmCTHQ at mail dot gmail dot com> <CAMe9rOog3XBDjP9FAiLFCP7A-ir9LxBWmpcyG07+-h9hp7EjNQ at mail dot gmail dot com> <CAAs8HmzkXkP261DGZiBGpwobSDaeBHZ-oosz_k3OXD4ycjGVJA at mail dot gmail dot com> <CAMe9rOqVHuFbddkdKrkn1zaA9ASvT76sTn3enKcYo6K_4_Z77Q at mail dot gmail dot com> <CAAs8HmzRztBefZKx7KoB2LwvVWydRXDDdrw5FnexcphvXPR7gQ at mail dot gmail dot com> <20150529193552 dot GA52215 at kam dot mff dot cuni dot cz> <CAAs8Hmxg2a77HdJuedSkO8EkfROvSx_V2VOcZtWUAEiXLC3G6g at mail dot gmail dot com> <CAJA7tRYsMiq7rx34c=z6KwRdwYxxaeP6Z6qzA4XEwnJSMT7z=Q at mail dot gmail dot com> <CAAs8HmxB9NyJQHRxTLj4gKntDgwFfri0VvwSR6vfA1HDTpFHaQ at mail dot gmail dot com> <556C16B1 dot 5080606 at arm dot com> <CAAs8Hmy3jZDkE1hNmojx9rBBAZ9tjCYHXHevojMTAYHZ5kp8hA at mail dot gmail dot com> <CAJA7tRbHAHi7i1xboTZadrJLE_Ry628pwLot6f3wdK4KzawqCQ at mail dot gmail dot com> <CAAs8Hmy6gFfoKrVWJ2tCWQZ6Lkez2DCikWozVgwFcY-peDtOhw at mail dot gmail dot com> <CAJA7tRYUMvHt04m-+uM9irXRXC57iV9pP0jqQKoj9AJ+rwuo2g at mail dot gmail dot com> <CAAs8HmzcD4-t2bbxVL93PSU-1Mp-AZ=Qd-JN8mmjw6pC1Q+h9g at mail dot gmail dot com>
On June 2, 2015 8:15:42 PM GMT+02:00, Sriraman Tallam <tmsriram@google.com> wrote:
[]
>I have now modified this patch.
>
>This patch does two things:
>
>1) Adds new generic function attribute "no_plt" that is similar in
>functionality to -fno-plt except that it applies only to calls to
>functions that are marked with this attribute.
>2) For x86_64, it makes -fno-plt(and the attribute) also work for
>non-PIC code by directly generating an indirect call via a GOT entry.
>
>For PIC code, no_plt merely shadows the implementation of -fno-plt, no
>surprises here.
>
>* c-family/c-common.c (no_plt): New attribute.
>(handle_no_plt_attribute): New handler.
>* calls.c (prepare_call_address): Check for no_plt
>attribute.
>* config/i386/i386.c (ix86_function_ok_for_sibcall): Check
>for no_plt attribute.
>(ix86_expand_call): Ditto.
>(nopic_no_plt_attribute): New function.
>(ix86_output_call_insn): Output indirect call for non-pic
>no plt calls.
>* doc/extend.texi (no_plt): Document new attribute.
>* testsuite/gcc.target/i386/noplt-1.c: New test.
>* testsuite/gcc.target/i386/noplt-2.c: New test.
>* testsuite/gcc.target/i386/noplt-3.c: New test.
>* testsuite/gcc.target/i386/noplt-4.c: New test.
>
>
>Please review.
--- config/i386/i386.c (revision 223720)
+++ config/i386/i386.c (working copy)
@@ -5479,6 +5479,8 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
&& !TARGET_64BIT
&& flag_pic
&& flag_plt
+ && (TREE_CODE (decl) != FUNCTION_DECL
+ || !lookup_attribute ("no_plt", DECL_ATTRIBUTES (decl)))
&& decl && !targetm.binds_local_p (decl))
return false;
Wrong order or && decl is redundant. Stopped reading here.
Thanks,