From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54552 invoked by alias); 19 Jun 2017 03:14:00 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 54499 invoked by uid 89); 19 Jun 2017 03:13:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=ridiculously X-HELO: mail-pf0-f196.google.com Received: from mail-pf0-f196.google.com (HELO mail-pf0-f196.google.com) (209.85.192.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 19 Jun 2017 03:13:57 +0000 Received: by mail-pf0-f196.google.com with SMTP id s66so14671243pfs.2 for ; Sun, 18 Jun 2017 20:14:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nGZr+XNtDRw0RXakb5Vy7rqC8796eXZUNMCz+iB1Hmc=; b=Vp6kr7JHqfsffwqSsLA3qxS8i3ORxEr8BSxlJsCKWVbxl9lHuz1f1R+COnOmqXJAoH P+DoeimqOIVicIeUlEfAhSpNF8zUXiu9kFJW871Ig7DP0e0CZcI0f+xyGBnk9s1I0Qqa CLfNl0UnpKxiEkjXewRESzDBtZdhYp8yXw/PGAqyW/Y4RGwGG1MnXyaYSx3/nNg0y5Fw M1nGtnPkPPNmZRc3F6hdp9DfMDyc0nHqggJx21UZgR115ytiwP4glWAE8CXZOdPyNGkL mWJJnLwYGpgyVKgHO4fxhAHBgGZxhhcoiZ9ZPtmHkfvLqXc4cJF0YwYyttwS7y2k4ICR iraA== X-Gm-Message-State: AKS2vOxCcO+TLPb5VxN80JOj9aCyIT0leRvT/ftmCARNJkFYdYxbuM1r DOSkp3sq1laqUA== X-Received: by 10.98.69.219 with SMTP id n88mr22489244pfi.93.1497842040479; Sun, 18 Jun 2017 20:14:00 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-71-80.tyqh2.lon.bigpond.net.au. [58.160.71.80]) by smtp.gmail.com with ESMTPSA id t2sm17325175pfi.76.2017.06.18.20.13.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jun 2017 20:13:59 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id D7D1DC3012; Mon, 19 Jun 2017 12:43:55 +0930 (ACST) Date: Mon, 19 Jun 2017 03:14:00 -0000 From: Alan Modra To: James Clarke Cc: binutils@sourceware.org Subject: Re: [PATCH 1/1] gold: Avoid duplicate PLT stub symbols on PowerPC Message-ID: <20170619031355.GR8406@bubble.grove.modra.org> References: <20170618215803.21349-1-jrtc27@jrtc27.com> <20170618215803.21349-2-jrtc27@jrtc27.com> <20170619030442.GQ8406@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170619030442.GQ8406@bubble.grove.modra.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00191.txt.bz2 On Mon, Jun 19, 2017 at 12:34:42PM +0930, Alan Modra wrote: > On Sun, Jun 18, 2017 at 10:58:03PM +0100, James Clarke wrote: > > If two objects are compiled with -fPIC or -fPIE and call the same > > function, two different PLT entries are created, one for each object, > > I'd be surprised if that was so when using your simple testcase, and > testing here verifies it. There is a situation where this can occur: > In a very large binary it may be necessary to create multiple stubs to > call a given function, because calls are so far apart that a single > stub cannot be reached by a "bl" instruction. However, that case > ought to be covered by this->uniq_ being different for each > stub_table. So I'm not sure how you are getting the failure. Incidentally, you can provoke multiple stubs with the small testcase by using a ridiculously small --stub-group-size=64 (and ignore all the warnings about section "exceeds group size". If I do that, I see nm printf | grep puts 0000000000000840 t 00000004.plt_call.puts 00000000000008a0 t 00000005.plt_call.puts U puts objdump also shows the two plt call stubs for puts. > > but the same stub symbol name is used for both. Therefore let's make > > the names unique by incorporating the object's uniq_ value where > > necessary. > > > > gold/ > > * (Stub_table::define_stub_syms): Include object's uniq_ value > > when set for non-local symbols as well. > > This won't work. object_ isn't set for ppc64 globals. See the > Plt_stub_ent constructors. -- Alan Modra Australia Development Lab, IBM