From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128628 invoked by alias); 10 May 2015 16:59:48 -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 128615 invoked by uid 89); 10 May 2015 16:59:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: atrey.karlin.mff.cuni.cz Received: from atrey.karlin.mff.cuni.cz (HELO atrey.karlin.mff.cuni.cz) (195.113.26.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 10 May 2015 16:59:47 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 4018) id A8F0C81FA7; Sun, 10 May 2015 18:59:44 +0200 (CEST) Date: Sun, 10 May 2015 16:59:00 -0000 From: Jan Hubicka To: Alexander Monakov Cc: gcc-patches@gcc.gnu.org, Rich Felker Subject: Re: [PATCH] Expand PIC calls without PLT with -fno-plt Message-ID: <20150510165943.GI9659@atrey.karlin.mff.cuni.cz> References: <1430757479-14241-1-git-send-email-amonakov@ispras.ru> <1430757479-14241-6-git-send-email-amonakov@ispras.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1430757479-14241-6-git-send-email-amonakov@ispras.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00857.txt.bz2 > This patch introduces option -fno-plt that allows to expand calls that would > go via PLT to load the address of the function immediately at call site (which > introduces a GOT load). Cover letter explains the motivation for this patch. > > New option documentation for invoke.texi is missing from the patch; if this is > accepted I'll be happy to send a v2 with documentation added. > > * calls.c (prepare_call_address): Transform PLT call to GOT lookup and > indirect call by forcing address into a pseudo with -fno-plt. > * common.opt (flag_plt): New option. > > diff --git a/gcc/common.opt b/gcc/common.opt > index b49ac46..cd8b256 100644 > --- a/gcc/common.opt > +++ b/gcc/common.opt > @@ -1773,12 +1773,16 @@ Common Report Var(flag_pic,1) Negative(fpie) > Generate position-independent code if possible (small mode) > > fpie > Common Report Var(flag_pie,1) Negative(fPIC) > Generate position-independent code for executables if possible (small mode) > > +fplt > +Common Report Var(flag_plt) Init(1) > +Use PLT for PIC calls (-fno-plt: load the address from GOT at call site) > + This won't play well with LTO since fplt will become another global flag while it affects codegen. I still did not catch up with the other thread and Hj's work on doing this transparently in linker, but if this is getting in, please add Optimization to fplt, so the PLT usage can be decided with per function granuality. Honza