access thread_local variable in inline assembly
I'm dealing with some C++ code that has an optimised version that uses inline assembly. The optimised version is exhibiting behaviour that is not thread safe, which can be traced to 3 global variables that are accessed extensively from inside the assembly. __attribute__ ((aligned (16))) unsigned int SHAVITE_MESS[16]; __attribute__ ((aligned (16))) thread_local unsigned char SHAVITE_PTXT[8*4]; __attribute__ ((aligned (16))) unsigned int SHAVITE_CNTS[4] = {0,0,0,0}; ... asm ("movaps xmm0, SHAVITE_PTXT[rip]"); asm ("movaps xmm1, SHAVITE_PTXT[rip+16]"); asm ("movaps xmm3, SHAVITE_CNTS[rip]"); asm