From patchwork Tue Jun 2 19:32:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernhard Reutner-Fischer X-Patchwork-Id: 479693 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 37397140280 for ; Wed, 3 Jun 2015 05:32:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=UzvtNF/v; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :in-reply-to:references:mime-version:content-transfer-encoding :content-type:subject:from:date:to:cc:message-id; q=dns; s= default; b=u1D1zEumT2A5/lPDUOAwAAHEAUbRwS+U5W+i6DrJQwYsn2yPUuWlZ i/0xLpmT27lzvSNhRRHCVvrRsdO18rArbWMwcrF1e21MDTpwUSWKLqjzegPmHFgL GszoRZdxnNoYDJWwvP8yr57Bi9iJdO/itaZpt7pc/79cGsoOgQbeII= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :in-reply-to:references:mime-version:content-transfer-encoding :content-type:subject:from:date:to:cc:message-id; s=default; bh= 6bfazolJjzCPhs333Hb3ip6yCDo=; b=UzvtNF/vFvfdIuEDokIUgSjGCXSQxyIJ ODOrfLamJKXRUK4aiYZIZUysk0TbqDTB8bu2qzdXNk3U6M5ZJw/EcZaSyjzSIpip 57b0fzlNxtcSJtZmXl3TLkAKZkzmWsncZ8LSKUvVyfDdnhjaVx6vzSgZ3nXK3yZQ 23pTGXd9XWw= Received: (qmail 105943 invoked by alias); 2 Jun 2015 19:32:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 105932 invoked by uid 89); 2 Jun 2015 19:32:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.6 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f45.google.com Received: from mail-wg0-f45.google.com (HELO mail-wg0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 02 Jun 2015 19:32:18 +0000 Received: by wgez8 with SMTP id z8so148466052wge.0 for ; Tue, 02 Jun 2015 12:32:16 -0700 (PDT) X-Received: by 10.180.13.40 with SMTP id e8mr33398265wic.50.1433273535936; Tue, 02 Jun 2015 12:32:15 -0700 (PDT) Received: from [10.41.147.71] (089144219071.atnat0028.highway.a1.net. [89.144.219.71]) by mx.google.com with ESMTPSA id mv11sm23068952wic.23.2015.06.02.12.32.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Jun 2015 12:32:14 -0700 (PDT) User-Agent: K-9 Mail for Android In-Reply-To: References: <20150529193552.GA52215@kam.mff.cuni.cz> <556C16B1.5080606@arm.com> MIME-Version: 1.0 Subject: Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt= From: Bernhard Reutner-Fischer Date: Tue, 02 Jun 2015 21:32:05 +0200 To: Sriraman Tallam ,ramrad01@arm.com CC: Ramana Radhakrishnan , Jan Hubicka , "H.J. Lu" , Pedro Alves , Michael Matz , David Li , GCC Patches Message-ID: X-IsSubscribed: yes On June 2, 2015 8:15:42 PM GMT+02:00, Sriraman Tallam 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. Wrong order or && decl is redundant. Stopped reading here. Thanks, --- 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;