[Fwd: Re: cvs commit: src/libexec/rtld-elf map_object.c rtld.c rtld.h rtld_tls.h src/libexec/rtld-elf/alpha reloc.c rtld_machdep.h src/libexec/rtld-elf/i386 reloc.c rtld_machdep.h ...]

From: Doug Rabson <dfr_at_nlsystems.com>
Date: Tue, 03 Aug 2004 16:43:09 +0100
For anyone who is interested that hasn't seen the commit mail...

-----Forwarded Message-----
From: Doug Rabson <dfr_at_nlsystems.com>
To: Doug Rabson <dfr_at_FreeBSD.org>
Cc: src-committers_at_FreeBSD.org, cvs-src_at_FreeBSD.org, cvs-all_at_FreeBSD.org
Subject: Re: cvs commit: src/libexec/rtld-elf map_object.c rtld.c rtld.h rtld_tls.h src/libexec/rtld-elf/alpha reloc.c rtld_machdep.h src/libexec/rtld-elf/amd64 reloc.c rtld_machdep.h src/libexec/rtld-elf/i386 reloc.c rtld_machdep.h ...
Date: Tue, 03 Aug 2004 14:24:11 +0100

On Tue, 2004-08-03 at 09:51, Doug Rabson wrote:
> dfr         2004-08-03 08:51:00 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     libexec/rtld-elf     map_object.c rtld.c rtld.h 
>     libexec/rtld-elf/alpha reloc.c rtld_machdep.h 
>     libexec/rtld-elf/amd64 reloc.c rtld_machdep.h 
>     libexec/rtld-elf/i386 reloc.c rtld_machdep.h 
>     libexec/rtld-elf/ia64 reloc.c rtld_machdep.h 
>     libexec/rtld-elf/sparc64 reloc.c rtld_machdep.h 
>   Added files:
>     libexec/rtld-elf     rtld_tls.h 
>   Log:
>   Add support for Thread Local Storage.

Thread Local Storage is a gcc feature which allows you to add a
'__thread' modifier to the declaration of global and static variables.
This extra modifier means that the variable's value is 'thread local',
i.e. one thread changing its value will not affect any other thread. In
lots of ways its similar to the per-cpu variables we use in the kernel.

Most of the support is in the dynamic linker which discovers the TLS
blocks in each shared libary and allocates memory for them. It provides
hooks for threading libraries to allocate and initialise TLS blocks for
each new thread and hooks which the compiler uses to resolve the address
of a TLS variable.

The main user for this right now is the OpenGL api. In OpenGL, each
thread has a GL context object associated with it. Each call to a GL
function implicitly references this context object. For single-threaded
OpenGL, the context can be found by e.g. a global variable but for
thread-safe OpenGL, the most efficient mechanism is to use TLS. This is
how the NVidia OpenGL driver supports threading and the open source
OpenGL drivers will use TLS in the future as well.

As far as FreeBSD goes, there is nothing in the system right now that
uses TLS. Its possible that we might use TLS for 'errno' and similar
things in the 6.0 timeframe.
Received on Tue Aug 03 2004 - 13:43:11 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:04 UTC