From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69285 invoked by alias); 3 Jun 2015 20:09:45 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 69271 invoked by uid 89); 3 Jun 2015 20:09:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.8 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,KAM_STOCKGEN,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 03 Jun 2015 20:09:43 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 77336B6F3D; Wed, 3 Jun 2015 20:09:42 +0000 (UTC) Received: from anchor.twiddle.net (vpn-228-230.phx2.redhat.com [10.3.228.230]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t53K9f82009318; Wed, 3 Jun 2015 16:09:41 -0400 Message-ID: <556F5F04.80603@redhat.com> Date: Wed, 03 Jun 2015 20:16:00 -0000 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Sriraman Tallam , Ramana Radhakrishnan CC: Jan Hubicka , "H.J. Lu" , Pedro Alves , Michael Matz , David Li , GCC Patches Subject: Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt= References: <20150529193552.GA52215@kam.mff.cuni.cz> <556C16B1.5080606@arm.com> <556F0EBF.90! 30005@arm .com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00359.txt.bz2 On 06/03/2015 11:38 AM, Sriraman Tallam wrote: > + { "no_plt", 0, 0, true, false, false, > + handle_no_plt_attribute, false }, Call it noplt. We don't add the underscore for noinline, noclone, etc. > Index: config/i386/i386.c > =================================================================== > --- config/i386/i386.c (revision 223720) > +++ config/i386/i386.c (working copy) > @@ -5479,7 +5479,10 @@ ix86_function_ok_for_sibcall (tree decl, tree exp) > && !TARGET_64BIT > && flag_pic > && flag_plt > - && decl && !targetm.binds_local_p (decl)) > + && decl > + && (TREE_CODE (decl) != FUNCTION_DECL > + || !lookup_attribute ("no_plt", DECL_ATTRIBUTES (decl))) > + && !targetm.binds_local_p (decl)) > return false; > > /* If we need to align the outgoing stack, then sibcalling would Is this really necessary? I'd expect DECL to be NULL in this case, since the non-use of the PLT will mean that the (sib)call is indirect. > @@ -25497,13 +25500,19 @@ ix86_expand_call (rtx retval, rtx fnaddr, rtx call > } > else > { > - /* Static functions and indirect calls don't need the pic register. */ > + /* Static functions and indirect calls don't need the pic register. Also, > + check if PLT was explicitly avoided via no-plt or "no_plt" attribute, making > + it an indirect call. */ > if (flag_pic > && (!TARGET_64BIT > || (ix86_cmodel == CM_LARGE_PIC > && DEFAULT_ABI != MS_ABI)) > && GET_CODE (XEXP (fnaddr, 0)) == SYMBOL_REF > - && ! SYMBOL_REF_LOCAL_P (XEXP (fnaddr, 0))) > + && !SYMBOL_REF_LOCAL_P (XEXP (fnaddr, 0)) > + && flag_plt > + && (TREE_CODE (SYMBOL_REF_DECL (XEXP(fnaddr, 0))) != FUNCTION_DECL > + || !lookup_attribute ("no_plt", > + DECL_ATTRIBUTES (SYMBOL_REF_DECL (XEXP(fnaddr, 0)))))) > { > use_reg (&use, gen_rtx_REG (Pmode, REAL_PIC_OFFSET_TABLE_REGNUM)); > if (ix86_use_pseudo_pic_reg ()) Why are you testing FUNCTION_DECL? Even if, somehow, the user were producing a function call to a data symbol, why do you think that lookup_attribute would produce incorrect results? Similarly in ix86_nopic_no_plt_attribute_p. r~