[PATCH] A fix for sanitizers' TLS support on FreeBSD

Alexey Samsonov samsonov at google.com
Tue Mar 18 01:37:31 PDT 2014

Comment at: lib/sanitizer_common/sanitizer_linux_libcdep.cc:392
@@ +391,3 @@
+  uptr tls;
+  GetTls(&tls, &g_tls_size);
On Linux we assume that TLS size is equal for all threads and store it in g_tls_size.

On FreeBSD you calculate it every time in GetTls(...) function using ThreadSelfSegbase(). If it may be different in different threads, then g_tls_size doesn't make any sense, and you should call GetTls(...) in GetTlsSize(). If it is the same in all threads, then you should cache it in g_tls_size in the same way as we do on Linux.


More information about the llvm-commits mailing list