From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41541 invoked by alias); 15 May 2015 23:49:11 -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 41527 invoked by uid 89); 15 May 2015 23:49:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RDNS_DYNAMIC,TVD_RCVD_IP autolearn=no version=3.3.2 X-HELO: brightrain.aerifal.cx Received: from 216-12-86-13.cv.mvl.ntelos.net (HELO brightrain.aerifal.cx) (216.12.86.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 May 2015 23:49:09 +0000 Received: from dalias by brightrain.aerifal.cx with local (Exim 3.15 #2) id 1YtPLg-0002eI-00; Fri, 15 May 2015 23:49:00 +0000 Date: Sat, 16 May 2015 00:18:00 -0000 From: Rich Felker To: "H.J. Lu" Cc: Jan Hubicka , Alexander Monakov , GCC Patches , Uros Bizjak Subject: Re: [PATCH i386] Allow sibcalls in no-PLT PIC Message-ID: <20150515234900.GH17573@brightrain.aerifal.cx> References: <20150515194824.GB14415@kam.mff.cuni.cz> <20150515202319.GE17573@brightrain.aerifal.cx> <20150515204237.GF17573@brightrain.aerifal.cx> <20150515230810.GA73210@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-05/txt/msg01472.txt.bz2 On Fri, May 15, 2015 at 04:34:57PM -0700, H.J. Lu wrote: > On Fri, May 15, 2015 at 4:30 PM, H.J. Lu wrote: > > On Fri, May 15, 2015 at 4:14 PM, H.J. Lu wrote: > >> My relax branch proposal works even without LTO. > >> > > > > I will borrow GOTPCREL from x86-64 and do > > > > [hjl@gnu-6 relax-4]$ cat b.S > > call *foo@GOTPCREL(%eax) > > call *foo@GOTPLT(%eax) > > is a better choice. foo@GOTPCREL is preferable (but does not yet exist for ia32, so the reloc type would have to be added) since it saves a useless add. Instead of: call __x86.get_pc_thunk.ax addl $_GLOBAL_OFFSET_TABLE_, %eax call *foo@GOTPLT(%eax) you can just do: call __x86.get_pc_thunk.ax call *foo@GOTPCREL(%eax) Note that it also works to have extra instructions between: call __x86.get_pc_thunk.ax 1: ... call *foo@GOTPCREL+(1b-.)(%eax) I may not have gotten the syntax quite right, but hopefully yoy get the idea. This same approach (with GOTPCREL) can be used for _all_ GOT accesses, including global data, to eliminate the useless add. Rich