On Wed, Jan 16, 2013 at 12:08 PM, Saul Tamari <stamari@xxxxxxxxx> wrote: > > Is ___tls_get_addr_internal() compiled from C source code or is it > generated directly in assembly code? > Where can I find the C source code that was used to generate > ___tls_get_addr_internal ? __tls_get_addr is provided by your C library. I don't think you mentioned what system you are using, but if it is a GNU/Linux system then __tls_get_addr defined by glibc. I'm not sure quite where __tls_get_addr_internal comes in. __tls_get_addr is defined in elf/dl-tls.c in the glibc sources. You seem to be using 32-bit x86; the interesting 32-bit x86 code is in nptl/sysdeps/i386/tls.h. It does indeed use %gs. You can't change %gs yourself if your program uses TLS variables. Ian