cvs commit: src/sys/sys tls.h src/lib/libc/gen tls.c src/lib/libthread_xu/arch/amd64/amd64 pthread_md.c src/lib/libthread_xu/arch/i386/i386 pthread_md.c src/libexec/rtld-elf rtld.c rtld.h rtld_tls.h src/libexec/rtld-elf/i386 reloc.c

Joerg Sonnenberger joerg at britannica.bec.de
Mon Mar 28 05:48:02 PST 2005


Sorry, I was offline for a few days.

On Sun, Mar 27, 2005 at 07:33:20PM -0800, Matthew Dillon wrote:
> dillon      2005/03/27 19:33:20 PST
> 
> DragonFly src repository
> 
>   Modified files:
>     sys/sys              tls.h 
>     lib/libc/gen         tls.c 
>     lib/libthread_xu/arch/amd64/amd64 pthread_md.c 
>     lib/libthread_xu/arch/i386/i386 pthread_md.c 
>     libexec/rtld-elf     rtld.c rtld.h rtld_tls.h 
>     libexec/rtld-elf/i386 reloc.c 
>   Log:
>   Cleanup and retool portions of the TLS support and make sure that
>   non-threaded binaries remain compatible with older kernels.
>   
>   * Removes the tcb alignment argument.  Instead an alignment #define is
>     placed in sys/tls.h

I'd like to get rid of the size argument too. This should be split into
machine/tls.h (with e.g. the struct tcb define) and sys/tls.h with the
general system call.

>   * Gets rid of the Variant I code (we can add it in later, it just gets
>     in the way).

That's why I wanted to use Variant I always. For the archive, there is one
nasty thing -- statically linked binaries. For those, ld itself does the
relocation and therefore it would have to be changed to go directly to
positive offsets.

>   
>   * Retools the Variant II code to support %gs:OFFSET (negative offset)
>     AND %gs:0 relative accesses, supporting both -mtls-direct-seg-refs and
>     -mno-tls-direct-seg-refs.

As Doug mentioned, this means m:n implementation has to do a syscall for
thread switched.

>   * Changes the Elf_Addr array for the TCB into a real structure in
>     sys/tls.h

There are a lot of places where Elf_Addr is used in the linker and
void * is meant. I have a patch laying around to solve that, will commit it
later.

>   
>   * Retains the DTV methodology.
>   
>   * Retains the TCB methodology, but note that the area 'after' the tcb
>     is now available for future use (at least with Variant I removed).
>     Frankly I'm not sure we would ever want to support having the
>     'data' area after the TCB instead of before the TCB, at least not
>     for i386.

Placing the TLS area after the TCB solves a lot of nasty problems :)

Joerg





More information about the Commits mailing list