From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 49748 invoked by alias); 11 May 2015 20:55:42 -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 49734 invoked by uid 89); 11 May 2015 20:55:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f175.google.com Received: from mail-ob0-f175.google.com (HELO mail-ob0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 11 May 2015 20:55:40 +0000 Received: by obblk2 with SMTP id lk2so109801210obb.0 for ; Mon, 11 May 2015 13:55:38 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.225.65 with SMTP id y62mr8946344oig.78.1431377738765; Mon, 11 May 2015 13:55:38 -0700 (PDT) Received: by 10.76.54.14 with HTTP; Mon, 11 May 2015 13:55:38 -0700 (PDT) In-Reply-To: <555112D7.8020809@redhat.com> References: <1430757479-14241-1-git-send-email-amonakov@ispras.ru> <1430757479-14241-6-git-send-email-amonakov@ispras.ru> <20150510165943.GI9659@atrey.karlin.mff.cuni.cz> <555112D7.8020809@redhat.com> Date: Mon, 11 May 2015 20:55:00 -0000 Message-ID: Subject: Re: [PATCH] Expand PIC calls without PLT with -fno-plt From: "H.J. Lu" To: Jeff Law Cc: Jan Hubicka , Alexander Monakov , GCC Patches , Rich Felker Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg01013.txt.bz2 On Mon, May 11, 2015 at 1:36 PM, Jeff Law wrote: > On 05/10/2015 10:59 AM, Jan Hubicka wrote: >>> >>> 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 know Richi explained this to me in the past, but I can't remember the > details of why this is bad. Can you walk me through it again? > I have proposed a different approach: https://gcc.gnu.org/ml/gcc/2015-05/msg00086.html -- H.J.