From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91424 invoked by alias); 24 Nov 2016 11:58:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 91411 invoked by uid 89); 24 Nov 2016 11:58:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1409, H*r:sta.dodo.net.au, mapped X-HELO: nymeria.archlinux.org Subject: Re: [PATCH] Don't use PLT nor GOT in libc.a [BZ #20750] To: "H.J. Lu" , Florian Weimer References: <20161104174739.GA5880@intel.com> <1129b1b2-5f7a-26c3-76a7-727a14fdadfb@redhat.com> Cc: GNU C Library From: Allan McRae Message-ID: Date: Thu, 24 Nov 2016 11:58:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2016-11/txt/msg00888.txt.bz2 Ping. My distribution wants to enable PIE and -z,now by default and this is required for glibc to build. Allan On 08/11/16 03:13, H.J. Lu wrote: > On Mon, Nov 7, 2016 at 8:03 AM, Florian Weimer wrote: >> On 11/04/2016 08:25 PM, H.J. Lu wrote: >>> >>> On Fri, Nov 4, 2016 at 12:03 PM, Florian Weimer >>> wrote: >>>> >>>> On 11/04/2016 06:47 PM, H.J. Lu wrote: >>>>> >>>>> >>>>> There is no need to use PLT nor GOT in libc.a to branch to a function, >>>>> regardless whether libc.a is compiled with PIC or not. >>>>> >>>>> Tested on x86-64. OK for master? >>>> >>>> >>>> >>>> Isn't this header file used outside of libc as well? >>> >>> >>> It is used for other .a files. If they aren't used to create static >>> binaries, >>> PLT/GOT may be used. The resulting executable will work correctly. >> >> >> You mean because “name” is automatically mapped to “name@plt”? > > No. There is no "@plt". Linker will create a PLT entry if the function > is defined in a shared object. > >> I find this comment not very illuminating: >> >> +/* For libc.a, we want to branch to target directly. */ >> # define JUMPTARGET(name) name >> >> And cheating the static linker in this way seems like a future maintenance >> hazard. >> > > It is ok as long as those static archives aren't used to create shared > objects. >