* emutls.c (__emutls_get_address): Avoid race condition between
obj->loc.offset read and emutls_key initialization.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193907
138bc75d-0d04-0410-961f-
82ee72b054a4
+2012-11-28 Richard Henderson <rth@redhat.com>
+
+ PR libgcc/48076
+ * emutls.c (__emutls_get_address): Avoid race condition between
+ obj->loc.offset read and emutls_key initialization.
+
2012-11-22 Georg-Johann Lay <avr@gjlay.de>
Adjust decimal point of signed accum mode to GCC default.
#ifndef __GTHREADS
abort ();
#else
- pointer offset = obj->loc.offset;
+ pointer offset = __atomic_load_n (&obj->loc.offset, __ATOMIC_ACQUIRE);
if (__builtin_expect (offset == 0, 0))
{
if (offset == 0)
{
offset = ++emutls_size;
- obj->loc.offset = offset;
+ __atomic_store_n (&obj->loc.offset, offset, __ATOMIC_RELEASE);
}
__gthread_mutex_unlock (&emutls_mutex);
}