From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.60) (envelope-from <gentoo-user+bounces-54895-garchives=archives.gentoo.org@gentoo.org>) id 1Gkqgi-0002VI-Oe for garchives@archives.gentoo.org; Thu, 16 Nov 2006 23:30:33 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.8/8.13.8) with SMTP id kAGNSJs8023111; Thu, 16 Nov 2006 23:28:19 GMT Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.231]) by robin.gentoo.org (8.13.8/8.13.8) with ESMTP id kAGNQ4Rb011271 for <gentoo-user@lists.gentoo.org>; Thu, 16 Nov 2006 23:26:07 GMT Received: by wx-out-0506.google.com with SMTP id i30so1160554wxd for <gentoo-user@lists.gentoo.org>; Thu, 16 Nov 2006 15:26:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=j1qvRZO257GJb6Kd8ntr8snqoE7vSLavHeHhUc2d76pJpucYJxygxgHvzKwnHbCx946IgBenFGfAaVGPOaGWn1Ln9k4qv0u4kH1DCM98G6xrWjiDek0gE8qAiW8hfncIQNKOIBm8A0vVcbLxDSV4M+t2riolzO75J81Y1h9QNBg= Received: by 10.70.32.10 with SMTP id f10mr1725076wxf.1163719563939; Thu, 16 Nov 2006 15:26:03 -0800 (PST) Received: by 10.70.110.3 with HTTP; Thu, 16 Nov 2006 15:26:03 -0800 (PST) Message-ID: <c52221f0611161526j62fff9d6tcb8e2f269a473f5@mail.gmail.com> Date: Thu, 16 Nov 2006 18:26:03 -0500 From: "Devon Miller" <devon.c.miller@gmail.com> To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Gcc complains about TLS and errno; I baffled In-Reply-To: <200611162219.10674.alan@linuxholdings.co.za> Precedence: bulk List-Post: <mailto:gentoo-user@lists.gentoo.org> List-Help: <mailto:gentoo-user+help@gentoo.org> List-Unsubscribe: <mailto:gentoo-user+unsubscribe@gentoo.org> List-Subscribe: <mailto:gentoo-user+subscribe@gentoo.org> List-Id: Gentoo Linux mail <gentoo-user.gentoo.org> X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_91850_21527762.1163719563889" References: <9acccfe50611161203k224d0297hb19c3f14b743611d@mail.gmail.com> <200611162219.10674.alan@linuxholdings.co.za> X-Archives-Salt: 1e557a7e-67e5-496d-af00-9de639b54ec4 X-Archives-Hash: 1b31e7e4861f12b3433869c1a12ef67d ------=_Part_91850_21527762.1163719563889 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline In this case, TLS stands for Thread Local Storage. Not to be confused with Transport Layer Security Welcome to the joy of overloaded acronyms :-P Using "int errno;" will not work in any multithreaded executable. You need to use errno via errno.h because errno isn't a simple int, but a dereferenced pointer to a per-thread instance (in thread local storage) of an int. That's there so that each thread gets its own private errno variable for error reporting. Otherwise, errno would be the value of the last system call on any thread, not necessarily the one that's trying to check errno. The error is indicating (albeit badly) that the program's definition of errno clashes with the TLS definition of errno. dcm On 11/16/06, Alan McKinnon <alan@linuxholdings.co.za> wrote: > > On Thursday 16 November 2006 22:03, Kevin O'Gorman wrote: > > I'm trying to compile a program that works on Solaris with gcc, but > > won't complile > > under Linux (either FC5 or Gentoo). It seems to be because writing > > int errno; > > works under Solaris gcc-3.4.3 (well, it passes the compiler anyway), > > but under Linux > > gcc-3.4.6 or -4.1.0 one has to > > #include <errno.h> > > which makes more sense. I would just make the change, but I'm > > baffled by the error message Linux gcc gives to the first > > declaration. It reads: > > > > /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../i686-pc-linux-gnu/bi > >n/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches > > non-TLS reference in /tmp/cc6urgct.o > > /lib/libc.so.6: could not read symbols: Bad value > > > > But when I try to look up TLS, all I get is a bunch of stuff about a > > server-to-server > > email security protocol. What is it talking about here, and where > > can I find out about it? > > It would appear to be a an issue between linuxthreads and nptl. How are > your nptl and nptlonly USE flasg set? > > This post that I find on google may start to give you more answers. It's > for a completely different package but the problem and solution seesmto > be the same as yours: > > http://www.rockbox.org/mail/archive/rockbox-dev-archive-2006-01/0020.shtml > > alan > -- > gentoo-user@gentoo.org mailing list > > ------=_Part_91850_21527762.1163719563889 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline In this case, TLS stands for Thread Local Storage. Not to be confused with Transport Layer Security<br> <br> Welcome to the joy of overloaded acronyms :-P<br><br>Using "int errno;" will not work in any multithreaded executable.<br><br>You need to use errno via errno.h because errno isn't a simple int, but a dereferenced pointer to a per-thread instance (in thread local storage) of an int. That's there so that each thread gets its own private errno variable for error reporting. Otherwise, errno would be the value of the last system call on any thread, not necessarily the one that's trying to check errno. <br> <br>The error is indicating (albeit badly) that the program's definition of errno clashes with the TLS definition of errno.<br><br>dcm<br><br><div><span class="gmail_quote">On 11/16/06, <b class="gmail_sendername">Alan McKinnon </b> <<a href="mailto:alan@linuxholdings.co.za">alan@linuxholdings.co.za</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> On Thursday 16 November 2006 22:03, Kevin O'Gorman wrote:<br>> I'm trying to compile a program that works on Solaris with gcc, but<br>> won't complile<br>> under Linux (either FC5 or Gentoo). It seems to be because writing <br>> int errno;<br>> works under Solaris gcc-3.4.3 (well, it passes the compiler anyway),<br>> but under Linux<br>> gcc-3.4.6 or -4.1.0 one has to<br>> #include <errno.h><br>> which makes more sense. I would just make the change, but I'm <br>> baffled by the error message Linux gcc gives to the first<br>> declaration. It reads:<br>><br>> /usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../i686-pc-linux-gnu/bi<br>>n/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches <br>> non-TLS reference in /tmp/cc6urgct.o<br>> /lib/libc.so.6: could not read symbols: Bad value<br>><br>> But when I try to look up TLS, all I get is a bunch of stuff about a<br>> server-to-server<br>> email security protocol. What is it talking about here, and where <br>> can I find out about it?<br><br>It would appear to be a an issue between linuxthreads and nptl. How are<br>your nptl and nptlonly USE flasg set?<br><br>This post that I find on google may start to give you more answers. It's <br>for a completely different package but the problem and solution seesmto<br>be the same as yours:<br><br><a href="http://www.rockbox.org/mail/archive/rockbox-dev-archive-2006-01/0020.shtml">http://www.rockbox.org/mail/archive/rockbox-dev-archive-2006-01/0020.shtml </a><br><br>alan<br>--<br><a href="mailto:gentoo-user@gentoo.org">gentoo-user@gentoo.org</a> mailing list<br><br></blockquote></div><br> ------=_Part_91850_21527762.1163719563889-- -- gentoo-user@gentoo.org mailing list