From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26404 invoked by alias); 9 Jul 2002 03:20:35 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26368 invoked from network); 9 Jul 2002 03:20:32 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 9 Jul 2002 03:20:32 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id 4D67D5EA11; Mon, 8 Jul 2002 22:20:30 -0500 (EST) To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: RFC: initial TLS patch References: <3D23129A.8070207@ges.redhat.com> <3D2A2D9F.10605@ges.redhat.com> From: Jim Blandy Date: Mon, 08 Jul 2002 20:48:00 -0000 In-Reply-To: <3D2A2D9F.10605@ges.redhat.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-07/txt/msg00135.txt.bz2 Andrew Cagney writes: > > But, to me, it seems like this interface explicitly reflects the > > quirks of the TLS implementation. What if some other TLS > > implementation requires, say, relocs to be applied to the > > initialization image? What if some processor with lots of registers > > puts small TLS variables in registers? (You could have register-sized > > relocs, and let the static linker assign the register number. > > Dynamically linked code couldn't do this, but that's okay.) > > > > Maybe that's contrived. But given how hairy TLS seems to be, I expect > > to see some variety in the implementations. And each time we > > encounter another variant, then this interface will need to again be > > expanded to accomodate that. This target method will end up showing > > every possible way anyone has ever constructed a thread-local value. > > For all we know, that thread implementation could be so incompatible > with what you're adding that they need to add yet another LOC. As I > noted before: > > > Having it return something more complicated like a ``struct value'' > can be left to the person that actually needs the mechanism - I figure > they will be in a better position to determine exactly what mechanism > is needed. > > I think this is very important. To apply the old engineering motto - > K.I.S.S. Yes, of course. And I think returning a `struct value' is the simpler thing to do. :) Right now, here's the interface which would accomodate the possibilities we know of today using the simplest datatypes: CORE_ADDR (*to_get_thread_local) (ptid_t thread, struct objfile *load_module, CORE_ADDR offset, int *init_image); Explaining what `init_image' means, and how to use CORE_ADDR in each case, and why it must be so, basically requires explaining the whole lazy thread-local storage allocation model. I can do that, but it seems more complex to me than explaining: struct value *(*to_get_thread_local) (ptid_t thread, struct objfile *load_module, CORE_ADDR offset, struct type *type); This is easy: "Return the object of type TYPE at offset OFFSET in THREAD's thread-local storage for LOAD_MODULE." One has to point out that thread-local storage blocks are both per-thread and per-load module --- the cartesian product --- but then you're done. At this point, I feel like I've explained my position about as well as I can, and you're not persuaded; since Michael S. hasn't said anything, I assume he isn't either. Since I don't think it'll be so bad to do it the way you suggest, I'll go with that, and we'll see how it goes. > I also noted that: > > > Perhaphs there should be a separate ``struct location'' object? > > I'll post this to gdb@. See, this makes no sense to me. If a `struct value' is too high-level a thing for a target method to return, why is `struct location' any different? The two seem part of the same structural layer to me. *shrug*