Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 4 Oct 2012 17:13:32 -0400
From: Rich Felker <>
Subject: TLS (thread-local storage) support


I've committed the initial version of thread-local storage
(__thread/_Thread_local keyword). So far, it only works in
static-linked applications, and might or might not be working properly
on arm, mips, and microblaze. The latter is a matter of whether these
archs need "TLS variant I" instead of the much cleaner/saner "variant
II" used by i386 and x86_64; unfortunately, Drepper's paper on TLS ABI
omits most of the interesting archs in favor of dying or dead ones
like Itanium, so I'm going to have to dig into other sources to find
out if musl needs to special-case any or all of these.

I also have the design for dynamic-linked TLS mostly worked out, but
need to make some changes to the dynamic linker to get it integrated.
Should be coming soon.

Reports of success or problems encountered are welcome, especially on
non-x86 archs, would be interesting/welcome.

Note that if you've been building gcc with --disable-tls, __thread was
already working but gets emulated (very poorly; it's slow and will
abort() if it runs out of memory) through libgcc. Such compilers are
useless for testing the new real TLS support, so rebuild without
--disable-tls if needed before testing.


Powered by blists - more mailing lists

Your e-mail address:

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.