From owner-freebsd-threads@FreeBSD.ORG Fri Jun 20 14:08:18 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2589537B401 for ; Fri, 20 Jun 2003 14:08:18 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 834E043F75 for ; Fri, 20 Jun 2003 14:08:17 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h5KL8GXh024323; Fri, 20 Jun 2003 17:08:16 -0400 (EDT) Date: Fri, 20 Jun 2003 17:08:16 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Marcel Moolenaar In-Reply-To: <20030620205945.GA19212@dhcp01.pn.xcllnt.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@freebsd.org Subject: Re: TLS: defining the problem space X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2003 21:08:18 -0000 On Fri, 20 Jun 2003, Marcel Moolenaar wrote: > On Fri, Jun 20, 2003 at 04:50:45PM -0400, Daniel Eischen wrote: > > On Fri, 20 Jun 2003, Marcel Moolenaar wrote: > > > If pthread defines __tls_get_addr() in complete executables and RTLD > > > defines __tls_get_addr() in shared executables, we have duplicate > > > definitions for shared executables, with pthread (using dynamic TLS). > > > Which takes precedence? [answer: RTLD] > > > > You can have one __tls_get_addr() be a weak definition, and > > lib{thr,pthread,c_r} can define a non-weak definition. > > Of course. The intend of the question was not to ask how, merely to > ask which. The answer is not simple, because what if we also have a > (weak) definition in libc to deal with the complete, without pthread > and dynamic TLS case (if we want to support that)? Then we have 3 > definitions. > If both libc and pthread provide weak definitions, then how do we > guarantee correct binding in the complete, with pthread and dynamic > TLS case. If libc and RTLD provide weak definitions, then how do we > guarantee proper binding in the shared, without pthread and dynamic > TLS case? libthr,pthread don't have to supply __tls_get_addr(). They can tell rtld that they are there and pass in a differently named function (during rtld_lock_init()). So now you're back down to two definitions. Does that help? > That's my point of having the problem space defined: we have a lot > of cases to cover and I want it nailed down and documented before we > do anything else. Of course. I'm just offering a possibility. Feel free to toss it if there are better ways. -- Dan Eischen