From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2767 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH 2/3] Have different definitions of __pthread_tsd_main agree in size Date: Sun, 10 Feb 2013 19:31:58 -0500 Message-ID: <20130211003158.GP20323@brightrain.aerifal.cx> References: <1360535367.23424.466.camel@eris.loria.fr> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1360542735 27475 80.91.229.3 (11 Feb 2013 00:32:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 11 Feb 2013 00:32:15 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2768-gllmg-musl=m.gmane.org@lists.openwall.com Mon Feb 11 01:32:36 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1U4hJv-0008QF-IH for gllmg-musl@plane.gmane.org; Mon, 11 Feb 2013 01:32:31 +0100 Original-Received: (qmail 7692 invoked by uid 550); 11 Feb 2013 00:32:12 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 7683 invoked from network); 11 Feb 2013 00:32:12 -0000 Content-Disposition: inline In-Reply-To: <1360535367.23424.466.camel@eris.loria.fr> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2767 Archived-At: On Sun, Feb 10, 2013 at 11:32:47PM +0100, Jens Gustedt wrote: > When switching optimization to higher levels (-O3) and enable link time > optimization (-flto) gcc finds two instances of the __pthread_tsd_main > variable that are declared with different sizes. > > The real size that is needed is known in both source files. Just use > equivalent definitions. > > 1 1 src/thread/pthread_self.c > > diff --git a/src/thread/pthread_self.c b/src/thread/pthread_self.c > index 23dbaa5..32a6e5d 100644 > --- a/src/thread/pthread_self.c > +++ b/src/thread/pthread_self.c > @@ -3,7 +3,7 @@ > static struct pthread *main_thread = &(struct pthread){0}; > > /* pthread_key_create.c overrides this */ > -static const void *dummy[1] = { 0 }; > +static const void *dummy[PTHREAD_KEYS_MAX] = { 0 }; > weak_alias(dummy, __pthread_tsd_main); Nope, that defeats the whole purpose, which is to avoid wasting space when it's not needed. This warning is bogus. There's no reason a weak symbol can't have different size than a strong one that optionally replaces it. Rich