This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [Dri-devel] Re: OpenGL and the LinuxThreads pthread_descr structure
On Tue, May 21, 2002 at 05:09:00PM -0700, Gareth Hughes wrote:
> David S. Miller wrote:
> >
> > Even if this were not the case, stupid compilation tools are not an
> > excuse to put changes into the C library. That is a fact.
>
> We've been talking about two completely separate issues:
>
> - Fast thread-local storage for libGL and GL drivers.
> - PIC for libGL and GL drivers.
>
> The only "changes" being talked about relate to the first of these
> issues, and have nothing to do with whether libGL is a true shared
> library or not.
>
> I'm interested to know if using __thread forces the use of -fPIC,
> because my first reading of Ulrich's document seemed to suggest this was
> the case. You say it's irrelevant, but I'd still like to know. If I am
> incorrect, then I have obviously misundersood some aspects of Ulrich's
> document and would like some clarification.
__thread doesn't require -fpic. There are 4 different TLS models (on IA-32):
-ftls-model=global-dynamic
-ftls-model=local-dynamic
-ftls-model=initial-exec
-ftls-model=local-exec
Neither of these require -fpic, though the first 3 use pic
register (if not -fpic, they just load it into some arbitrary register).
The GD model is for dlopenable libraries referencing __thread variables
that can be anywhere (and is most expensive, a function call), LD is for
dlopenable libraries referencing __thread variables within that library
(again, a function call, but can be one per whole function for all __thread
vars mentioned in it), IE is for libraries/programs which cannot be dlopened
and can reference __thread variables anywhere in the startup program
or its dependencies and LE is for programs only, referencing
__thread variables in it. IE involves a memory load from GOT and subtracts
that value from %gs:0, LE results in immediate being added to %gs:0.
Jakub