From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13923 invoked by alias); 1 May 2015 15:01:46 -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 13911 invoked by uid 89); 1 May 2015 15:01:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 May 2015 15:01:45 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 01 May 2015 08:01:32 -0700 X-ExtLoop1: 1 Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.42]) by orsmga002.jf.intel.com with ESMTP; 01 May 2015 08:01:32 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id BE133301D27; Fri, 1 May 2015 08:01:31 -0700 (PDT) From: Andi Kleen To: Sriraman Tallam Cc: GCC Patches , "H.J. Lu" , David Li Subject: Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt= References: Date: Fri, 01 May 2015 15:01:00 -0000 In-Reply-To: (Sriraman Tallam's message of "Thu, 30 Apr 2015 17:31:30 -0700") Message-ID: <87r3r0mjec.fsf@tassilo.jf.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2015-05/txt/msg00057.txt.bz2 Sriraman Tallam writes: > > This comes with caveats. This cannot be generally done for all > functions marked extern as it is impossible for the compiler to say if > a function is "truly extern" (defined in a shared library). If a > function is not truly extern(ends up defined in the final executable), > then calling it indirectly is a performance penalty as it could have > been a direct call. Further, the newly created GOT entries are fixed > up at start-up and do not get lazily bound. This means you need to make it depend on -fno-semantic-interposition ? > Given this, I propose adding a new option called > -fno-plt= to the compiler. This tells the compiler > that we know that the function is truly extern and we want the > indirect call only for these call-sites. I have attached a patch that > adds -fno-plt= to GCC. Any number of "-fno-plt=" can be specified and > all call-sites corresponding to these named functions will be done > indirectly using the mechanism described above without the use of a > PLT stub. The argument seems awkward. The command line may get very long. Better an attribute? Longer term it would be probably better to support it properly in the linker. -Andi -- ak@linux.intel.com -- Speaking for myself only